|
Signing Your Application - App 數字簽名
此文章由 dalaohu 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 dalaohu 所有!转贴必须注明作者、出处和本声明,并保持内容完整
昨晚看了一下 app的數字簽名。 跟大家分享一下。
你的app要發布到marketplace之前一定要有digitally signed.
The Android system requires that all installed applications be digitally signed with a certificate whose private key is held by the application's developer. The Android system uses the certificate as a means of identifying the author of an application and establishing trust relationships between applications. The certificate is not used to control which applications the user can install. The certificate does not need to be signed by a certificate authority: it is perfectly allowable, and typical, for Android applications to use self-signed certificates.
你要用到3個工具。
keytool, jarsinger 來自Java SDK. zipalign 來自 Android SDK.
首先,為了方便, 你笑要把系統路徑設好。
sudo nano /etc/paths
用這個命令,打開後加入把java 和 android路徑。然後保存。
我用的是全手工方法,這樣不管你用什麼IDE,後手寫都通用。
1. keytool -genkey -v -keystore myawesomekey.keystore -alias myawesomekey -keyalg RSA -keysize 2048 -validity 10000
keystore 會產生在當前目錄下。
2. Sign your app using jarsinger and the keystore you just generated.
jarsigner -verbose -keystore myawesomekey.keystore my_awesome_app.apk my_awesome_app
To verify that your .apk is signed, you can use a command like this:
jarsigner -verify my_awesome_app.apk
3. Align the final APK package
zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk
現在你有app就應該可以上傳到Marketplace 了, 以後會發個貼講。 |
|