简体   繁体   中英

How to sign Android APK using v2 signature in Ionic 3 CLI?

I am trying to upload a new build for Ionic 3 app. Now the Google Play Store is asking me to target minSDK 30 which is have done. But now the Google Play Store is returning message:

ERROR: MIN_SIG_SCHEME_FOR_TARGET_SDK_NOT_MET: Target SDK version 30 requires a minimum of signature scheme v2; the APK is not signed with this or a later signature scheme.

I tried to sign using apksigner but whenever I run the command I get error as Atleast one signer must be specified.

I did the following steps;

ionic cordova build android --prod --release
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name
zipalign -v -p 4 HelloWorld-release-unsigned.apk HelloWorld.apk
apksigner sign --ks my-release-key.keystore HelloWorld.apk

I can use the zip align but cannot sign using apksigner. Please help

Generate an App Bundle instead of an APK:

ionic cordova build android --prod --release -- -- --packageType=bundle

And then sign in with .jks

jarsigner -sigalg SHA256withRSA -digestalg SHA-256 -keystore app.jks AppName.aab AppName

or .keystore

jarsigner -sigalg SHA256withRSA -digestalg SHA-256 -keystore app.keystore AppName.aab AppName

I am using this as a quick fix hack after the zipalign step is done:

zipalign -v 4 HelloWorld-release-unsigned.apk HelloWorld.apk

I have followed this extra step:

apksigner sign --ks app.keystore --v1-signing-enabled true --v2-signing-enabled true HelloWorld.apk

Please note: use the same password you used for the keystore file. So now you can upload your.apk file or.aab file to play store

https://ionicframework.com/docs/v1/guide/publishing.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM