2

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

Tomislav Stankovic
  • 3,080
  • 17
  • 35
  • 42
user7500984
  • 127
  • 12
  • Ensure you use apksigner from a correct build-tools version, I use build-tools 30.0.2 `$ANDROID_SDK_ROOT/build-tools/30.0.2/apksigner` – Troopers Feb 23 '22 at 15:30

2 Answers2

2

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
Tomislav Stankovic
  • 3,080
  • 17
  • 35
  • 42
  • I tried the above command to build bundle but the bundle output is not created. When I run gradle bundle, I am getting > Minimum supported Gradle version is 7.0.2. Current version is 6.7.1. If using the gradle wrapper, try editing the distributionUrl in /Users/sanimshakya/Desktop/sesame/platforms/android/gradle/wrapper/gradle-wrapper.properties to gradle-7.0.2-all.zip even though I have made the changed as written – user7500984 Feb 24 '22 at 03:37
  • @user7500984 Check https://stackoverflow.com/questions/61364268/unable-to-generating-an-android-app-bundle-from-your-ionic-app-without-android and https://stackoverflow.com/questions/62147493/minimum-supported-gradle-version-is-6-1-1-current-version-is-5-6-4 – Tomislav Stankovic Feb 24 '22 at 06:38
0

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

Aishwarya
  • 41
  • 5