Why am I getting the following upload error and how do I fix it?

379 Views Asked by At

I signed my apk using the command:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore MyFocusKeystore.keystore C:\Users\Public\Documents\Unity_Projects\Shapes\Focus.apk myfocus

and zipaligned it using the command:

zipalign -v 4 "C:\Program Files\Android\Android Studio\jre\bin\Focus.apk" "C:\Program Files\Android\Android Studio\jre\bin\Focus-zipaligned.apk"

I verified everything and uploaded it in Google Developer Console. But I got the below upload error:

RSA uses digest algorithm SHA-256 and signature algorithm RSA which is not supported on API Level(s) 16-17 for which this APK is being verified.

Error that I got in Google Developer Console

Could someone help me fix this problem? Thanks in advance!

1

There are 1 best solutions below

5
On

Add the flag -sigalg SHA1withRSA to the command.

The default value of this flag is SHA256withRSA and SHA256 is not supported on SDK 16 and 17 apparently.

Note that if you switch to using apksigner (available in SDK Tools) to sign your app, you won't have to think about this since it will automatically select the best algorithms for your app based on the minSdkVersion. If you decide to switch (which I'd recommend you to), keep in mind that you'll need to sign after you zip-align.