VisualStudio2015 编译Android Java工程, 手动执行APK签名

xingyun86 2018-12-23 2074

Figered it out now. Built APK file can be signed by using command line (without need of installing Android Studio). This can be done as follows:


1.) Bellow will allow to build unsigned APK in release mode:

.packing project Properties --> Ant --> Ant Build Target --> Release (Release Mode)

or

.packing project Properties --> Release, build.gradle--> Release (Release Mode)


2.) Add JDK and Android SDK to PATH. In my case (installed by VS installer) those paths are:

X:\Java\jdk1.8.0_192\bin

X:\Android\android-sdk\build-tools\19.1.0


3.) Create keystore with key:

keytool -genkey -v -keystore myapp.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 20000

keytool -importkeystore -srckeystore imewebnetkey.keystore -destkeystore imewebnetkey.keystore -deststoretype pkcs12


4.) Sign APK:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myapp.keystore myapp-release-unsigned.apk alias_name


5.) ZIP align:

zipalign -f -v 4 myapp-release-unsigned.apk myapp-release-signed.apk


6.) Drag and drop to Play Store


×
打赏作者
最新回复 (0)
查看全部
全部楼主
返回