Ionic打包Android应用签名
2015-09-20 23:25
507 查看
先了解两件事情:
Keytool 是一个有效的安全钥匙和证书的管理工具.Android 要求所有的程序必须有签名,否则就不会安装该程序。
生成命令
注意:记得将alias_name改一下。1 | $ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 |
123456789 | Enter keystore password:Re-enter new password:What is your first and last name? [Unknown]: phodalWhat is the name of your organizational unit? [Unknown]: phodalWhat is the name of your organization? [Unknown]: phodalWhat is the name of your City or Locality? |
构建 Android应用
生成 release包
Cordova提供了一组设备相关的API,通过这组API,移动应用能够以JavaScript访问原生的设备功能,如摄像头、麦克风等。1 | $ cordova build --release android |
This is the method I used to use and it isn’t Cordova CLI specific (it’s part of the Java SDK build tools and this method is part of their standard
documentation). After you have created your APK (
cordova build android --release) you can run the following command:
1 | $ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore release_key_name.keystore app_name.apk alias_name |
Method 2: Part of the CLI workflow
The ant.properties thing needs an update in this writeup
as of today, since Android now uses gradle. For gradle, therelease-signing.properties as
mentioned below somehow didn't work for me. I created ‘build-extras.gradle’ (in the same directory as build.gradle i.e. platforms/android) containing the reference to the file containing the keystore information, the content of build-extras.gradle is as follows:
ext.cdvReleaseSigningPropertiesFile='release-signing.properties'
As mentioned in build.gradle this file is always executed (https://cordova.apache.org/doc...
The name of this properties file can be anything, content is signing information like:
storeFile=C:/Users/ra/../key_related/cra_an_key.keystore
storeType=jks
keyAlias=cra
Also I turned to Java 6 (version 23), b'cos of known certificate signing issues. And finally gave the command :
cordova build android -release
参考链接:
http://wincn.net/2015/08/06/Ionic%E6%89%93%E5%8C%85Android%E5%BA%94%E7%94%A8%E6%8C%87%E5%8D%97/ http://ilee.co.uk/Sign-Releases-with-Cordova-Android/
相关文章推荐
- Android Studio引用mipmap中引用.9图片报错
- Android使用Mob移动开发SDK笔记
- Android Animation的一些简单用法
- 13.Android xmlns:tools 技巧
- Android 深入浅出之 Binder机制
- android Flag启动模式
- Android 进程通信-- Binder机制
- Android--shape-指定图形的corners、gradient、padding、size、solid、stroke属性
- 深入理解Android View(转)
- Android Studio R.Java 的问题
- Android 编译时解析注解
- Android中getView与inflate方法的详解
- Android集成友盟社会化分享
- Android 图形与图像动画 知识框架
- Android_Studio的学习2--创建第一个项目
- Android开发工具ADT关联源码与API文档
- Android基础学习之viewpager(左右滑页卡)
- Android横竖屏切换及其对应布局加载问题
- [Android]关于RecyclerView控件的使用
- Android Transition框架介绍&使用