apk签名

参考:http://stackoverflow.com/questions/13578134/how-to-automate-keystore-generation-using-the-java-keystore-tool-w-o-user-inter

          http://developer.android.com/tools/publishing/app-signing.html

安装APK时出现:install_parse_failed_no_certificates

I)Create keystore

keystore=<projectname.keystore> //例如 keystore=helloworld.keystore,亦可不是工程名

keystore_alias_name=${keystore} //设置成一样

storepass=sxxxxxw //设置密码

keypass=${storepass} //习惯性设置成一样的

signaturename="CN=www.cnblogs.com_openix OU=SEU O=SEU L=NanJin ST=JiangSu C=NJ"

keytool
-genkey -v -keystore ${keystore} -alias ${keystore_alias_name} -storepass ${storepass} -keypass ${keypass} -keyalg RSA -validity 20000 -dname "${signaturename}"

 

II)Create signed release APK

jarsigner -verbose -keystore ${keystore} -storepass ${storepass} -keypass ${keypass} -sigalg SHA1withRSA -digestalg SHA1  -signedjar bin/apk_name.apk_signed bin/apk_name.apk  ${keystore_alias_name}

zipalign
-v 4 bin/apk_name.apk_signed bin/apk_name.apk_release
rm bin/apk_name.apk_signed

 

 

posted on 2014-04-28 16:29  阿加  阅读(291)  评论(0编辑  收藏  举报

导航