0

I made a release apk using buildozer android release command. Then I sign and zipalign my apk using following commands.

genarate keystore file [before] - keytool -genkey -v -keystore myapp.keystore -alias myalias -keyalg RSA -keysize 2048 -validity 10000

generate keystore file [after] - keytool -importkeystore -srckeystore myapp.keystore -destkeystore myapp.keystore -deststoretype pkcs12

sign apk - jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myapp.keystore myapp-0.1-arm64-v8a-release-unsigned.apk myalias

zipalign apk - zipalign -v 4 myapp-0.1-arm64-v8a-release-unsigned.apk playstore-release.apk

After everything done play store gives this error - You uploaded an APK with an invalid signature (learn more about signing). Error from apksigner: 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

target max api 30 and min api 21, sdk 30 used

How i upload my apk to playstore in 2021

oguz ismail
  • 1
  • 16
  • 47
  • 69

2 Answers2

1

First, your project must be able to run on an android with .apk on debug and unsigned mode.

If it's the case you can read theses 2 steps.

First you must signed your application to be sure that you are the only one that can update it (prevent from malicious algo insertion).

Change this in your buildozer.spec file:

#App store ask us to have this architecture and the latest api available (actually 29)

android.arch = arm64-v8a

android.api = 29

#Each time you update your apk on the app store, you have to incremente this variable by 1. It's 8211 by default BUT BE AWARE, you have to change it from the start (I begin with 1):

android.numeric_version = 1


Now that your key is signed, go on the terminal and:

---- FULFILL FOLLOWING VARIABLES ----

project_path=~/MY/PATH

key_filename=mykeyfilename

key_alias=mykeyaliasname

password="turlututu"

---- TO DO ONLY ONE TIME ----

mkdir -p ~/keystores/

keytool -genkey -v -keystore ~/keystores/$key_filename.keystore -alias $key_alias -keyalg RSA -keysize 2048 -validity 10000

---- a warning is printed and advice us to migrate to PKCS12 so we do it ----

keytool -importkeystore -srckeystore ~/keystores/$key_filename.keystore -destkeystore ~/keystores/$key_filename.keystore -deststoretype pkcs12

---- ENDING OF THE PART TO DO ONLY ONE TIME ----

export P4A_RELEASE_KEYSTORE=~/keystores/$key_filename.keystore export P4A_RELEASE_KEYSTORE_PASSWD=$password export P4A_RELEASE_KEYALIAS_PASSWD=$password export P4A_RELEASE_KEYALIAS=$key_alias cd $project_path buildozer -v android release

  • I personnally let the min/max api variable commented so your error may come from this changement. –  Feb 01 '21 at 15:02
  • Thanks for answer, I will check this – Savin Kisunu Feb 02 '21 at 16:19
  • After done these steps perfectly [max api not changed] play store gives this error - You uploaded an APK with an invalid signature (learn more about signing). Error from apksigner: ERROR (Jar signer CERT.RSA): JAR signature META-INF/CERT.SF indicates the APK is signed using APK Signature Scheme v2 but no such signature was found. Signature stripped? – Savin Kisunu Feb 03 '21 at 03:01
0

(I can't comment for the moment so I write here). I don't know for this error and I don't have the time to search sorry.

Little hint: here they talk about Visual Studio problem, maybe it's your case ?