How do I sign my android app bundle with the correct signing key?
-
1Were you able to reset your key on the Play Console? I'm having the same issue and support is not replying my request to reset the key from their end. – rraallvv Feb 13 '19 at 23:22
-
@rraallvv currently in your position - they're not getting back. Does it just take a while? – HJo Jan 09 '21 at 17:16
-
1@HamishJohnson they eventually did reset my account, although I don't remember exactly the time it took for me to get the issue solved. Sorry I couldn't be more helpful. – rraallvv Jan 09 '21 at 21:30
28 Answers
I was banging my head on the table over this for about two hours. When I finally gave up and was filling out my "reset key" request, I realized that I was currently attempting to upload it to the wrong project the whole time.
So, step one: confirm that you're attempting to upload to the correct project.
- 2,782
- 4
- 31
- 47
-
6I'm glad I read this comment, as this was, in fact, my error that led me to Google this. Always smart to double check ourselves, eh? – Steven Matthews Oct 15 '19 at 21:15
-
2
-
1But how does Google know what the "right project" is? Do I need to fill in something on the Play Console that specifically tells it which project on my machine is going to be uploaded? Where is that? – interstar Dec 23 '21 at 20:47
-
@interstar In the left nav of the Play Console, go to Setup > App Integrity. The key must match the settings there. For information on setting it up, check out https://support.google.com/googleplay/android-developer/answer/9842756?visit_id=637769193465112147-1168402504&rd=1 – David Jan 04 '22 at 18:57
-
-
@gumuruh You can't do that from inside the store, but only from inside the developer console. That said, I'm not sure anymore. You might have to search elsewhere to find it, or it's possible that they don't do that anymore, and you should just re-download the certificate or something. – David Mar 28 '22 at 20:30
-
1
-
3
-
I tried using the multiple answers here & in this question, but somehow I was getting this error because I had some issues with my android/app/build.gradle and android/gradle.properties files.
Two things you should check (in addition to the other solutions here) are:
- In
android/gradle.propertiesandandroid/app/build.gradle, make sure yourkeystorevariables match exactly.- In
android/gradle.properties, you probably have something like this:MYAPP_RELEASE_STORE_FILE=<> MYAPP_RELEASE_KEY_ALIAS=<> MYAPP_RELEASE_STORE_PASSWORD=<> MYAPP_RELEASE_KEY_PASSWORD=<> - Make sure these variable names exactly match those in
android/app/build.gradle:android { ... signingConfigs { release { if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) { storeFile file(MYAPP_RELEASE_STORE_FILE) storePassword MYAPP_RELEASE_STORE_PASSWORD keyAlias MYAPP_RELEASE_KEY_ALIAS keyPassword MYAPP_RELEASE_KEY_PASSWORD } } } }
- In
- In
android/app/build.gradle, make sure you setsigningConfigtosigningConfigs.releasein yourreleasebuildTypes:android { ... buildTypes { debug ... release { signingConfig signingConfigs.release } } }
- 6,245
- 2
- 43
- 59
-
3Thanks so much, this helped me after I moved my React Native app to another boilerplate project for better directory structure, but failed to deploy the new app version with the old Keystore file. – Mahad Ahmed Jun 03 '20 at 13:47
-
3Also running `./gradlew clean` before building the app helps clear previously cached builds. – Mahad Ahmed Jun 03 '20 at 13:50
-
9Thanks a lot. I had no idea what was going on. My `signingConfig` was pointing to `signingConfigs.debug`. It worked after changing it to release. – Chaitanya Bankanhal Jul 23 '20 at 16:17
-
2Ah thanks so much!!. I was following the react native instructions at https://reactnative.dev/docs/signed-apk-android. It's really easy to miss the change under `buildTypes` – Casey L Jan 29 '21 at 05:58
-
1
-
-
Thanks..My signingConfig was also pointing to signingConfigs.debug. It worked after changing it to release. – questerstudios Jan 21 '23 at 10:11
-
OMG, the Same thing happened to me today. Was uploading to a different app all together – Manoj ahirwar Mar 28 '23 at 14:13
The error suggests that you have uploaded an APK or an App Bundle previously. All the artifacts you upload to the Play Console should all be signed with the same keystore. So the error means that you signed the App Bundle with a key that is different than the ones you have uploaded previously. You have to either find that keystore you used before or reset the key by contacting Play Console support team.
- 15,865
- 4
- 36
- 50
-
1sorry but I got the same error as the topic. after the reset of the key I am not able to proceed: always same error. Can you give help me(also with private message) to upload a new app bundle? I lost my original jks and I can't afford to sign app bundle with new SHA1 key! – Fausto Apr 23 '19 at 11:26
-
1When you reset the key, you have had to create a new keystore and a new key in that keystore. You then sent to Google the certificate associated with that key. That's the key you need to use to sign your app with. – Pierre Apr 24 '19 at 19:01
-
2ah ok, so I send to google the new .pem file associated with the new .jks keystore. After their response I can use that new .jks.. Perfect! thank you very much – Fausto Apr 25 '19 at 15:02
-
2
-
-
1@Fausto How long does it take for the team to reset our key for your experience? – Say OL Apr 19 '23 at 03:32
Read this is you have requested a new upload key from Google Play and still get this error (should work for both native Android and Flutter as well).
I had experienced the same problem. And here's out steps on how to resolve it:
- We've lost the upload key (initial keystore file, probably .jks) that was used to sign the app.
- We created a new keystore file and exported created certificate to PEM format as stated here in the docs. We sent the request to the Google Play Team to reset our key, attached .pem file.
- When Google Play team reset the key we've tried to use the new .jks keystore we had created in the step 2 and the error appeared one more time, unfortunately.
The solution is to clean your project, rebuild it from scratch to reset all the cached builds.
In case of Flutter (we had this error building the app using Flutter). Make sure you use
flutter clean
Build the application on simulator or device.
Then run:
flutter build appbundle --release
This is how it was solved in our case.
PS. This should also help on native Android too.
- 4,311
- 1
- 38
- 49
- 161
- 1
- 5
-
-
1sometimes its not work. if you are using same project code with some changes for different purpose. this soloution will work. – Syed Hasan May 26 '22 at 07:23
-
3
-
1its now called App Integrity, therer is a link under Setup on the side bar. Or in the spot where the previous option was as 'Get Integrity Protection' and then App Sigining. – anzbert Jul 11 '23 at 15:03
Just rebuild the project and generate signed apk once again and try !
Wasted my 2 days on this, had my keystore key but still showed error and request google for generating new key.... Read some random stackoverflow, where it was written to rebuild the project and try uploading once again.. IT WORKED !
-
1
-
1@rjtubera In Android Studio, just go to Build -> Rebuild Project (I'd recommend doing Build -> Clean Project before rebuilding) – Blundering Philosopher Jun 24 '20 at 07:13
-
I got the same error :
In my case, I was trying to upload debug version. That caused me this error.
So I changed below line in app-level Gradle:
signingConfig signingConfigs.debug
With:
signingConfig signingConfigs.release
- 191
- 2
- 3
Well after wasting hours on this problem ,Below Solution works for me -
When you are creating signed bundle it gets saved to some location, Then when it gets rejected, you went again to make new Signed Bundle, Well thats where the mistake happens.
See when now you will create another signed bundle, you sign it another folder , assuming that previous one was made last time, , make sure you store the signed key in the "SAME FOLDER", No need to make any new signed key path , JUST use the path you used while doing it for First time.
See this image, use the same path which you have used during first time
Use the same JKS FILES as you have used for the first time. NOW WHEN YOU WILL MAKE BUNDLES FILE, IT WILL BE HAVING THE CORRECT KEY.
Thank You!!!
- 379
- 4
- 5
React Native here!
I got this error after trying to upload the generated .aab file from the ./gradlew bundleRelease command. I fixed it by exporting the .aab file by using Android Studio again. I believe that this is the way to upload your first .aab file to Google Play anyway. In case you don't know how:
In Android Studio:
- Open you React Native's project android folder
- Go to Build -> Generate Signed Bundle / APK
- Select Android App Bundle
- Enter your key-store details (if this is your first time doing this, you have to check the Export encrypted key checkbox, which you can use for Google Play App signing) and click Next
- When Android Studio finishes it gives you the option to locate the file(s) created
Now if you upload this .aab file, it should be accepted.
- 145
- 1
- 5
Late answer(for any one possibly still struggling with this topic)-
You may have forgot the .jks file of that project.
Search for .jks files in File explorer.
Connect it to your project.
- 1,088
- 2
- 10
- 23
- 51
- 3
-
1@Nilesh Deshmukh How do you connect a different .jks file to your project? – gkeenley Sep 05 '21 at 18:49
I just discarded the previous release and then create a new release and uploaded the app-release.aab.
- 1,492
- 2
- 16
- 28
I got the same error and it consumed my lot time
Here the simple solution just change debug
signingConfig signingConfigs.debug
to release
signingConfig signingConfigs.release
- 1,010
- 9
- 10
I realized that when I upload apk it gives more detailed error. so maybe try that solve errors and maybe then try app bundle.
hope it helps.
- 99
- 6
-
Yes it helps. If you will try uploading APK instead of .aab then it will give you detailed error. – pravingaikwad07 Aug 24 '20 at 06:59
For those who have released apk without a manually generated keystore and facing this issue when trying to release the apk or bundle from a different machine, follow the below steps:
Copy debug.keystore (C:\Users\username\.android\debug.keystore) from the machine which used to build the first version of the App
Select Build > Generate Signed Bundle/APK
Provide the Key store path to the debug.keystore file
Fill the other fields with the default values mentioned below and build
Keystore name: "debug.keystore"
Keystore password: "android"
Key alias: "androiddebugkey"
Key password: "android"
CN: "CN=Android Debug,O=Android,C=US"
- 629
- 8
- 18
Make sure you are using the correct JKS for App Signing.
Common developer error, Android app with multiple flavours sign bundle using different JKS file.
- 1,277
- 15
- 17
In google play console I solved this issue by going to the aab archive tab and removed all existing versions there. Then I went back to production and choose change key for app signing. After this I could successfully upload my aab file.
- 504
- 8
- 17
In my case, the problem was because I had 2 entries in my keystore file. If anyone has tried the suggestions above and nothing worked, then try this:
Open a command prompt or terminal window.
Navigate to the directory where your keystore file is located.
Run the following command to see how many entries are there in your keystore file:
keytool -list -v -keystore <keystore.jks>
Replace <keystore.jks> with the name of your keystore file.
If you have more than 1 entries and need to remove enteries that does not match the one google play console is refusing, use the following command to remove the unwanted entries one after the other
keytool -delete -alias <alias_name> -keystore <keystore.jks>
Replace <alias_name> with the alias name of the entry that you want to delete and <keystore.jks> with the name of your keystore file.
Enter the password for your keystore when prompted.
This will delete the specified entry from your keystore. Make sure you select the correct alias name to delete as this action cannot be undone.
Note: Deleting an entry from a keystore can affect any application that uses the same keystore, so make sure you have a backup of your keystore before performing this action.
If you found this useful, don't thank me. Thanks to chatGPT
- 330
- 2
- 11
What I did was exclude my android files from git, then when I changed branch and rebuilt, my build.gradle file was overwritten.
- 21,799
- 13
- 85
- 104
I had the same error when building a signed Android App Bundle.
For debug purposes on the local maschine, I enabled debuggable in the release build type.
It seems, Playstore recognized an debug build and simply said it is not a valid Bundle.
build.gradle:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
//debuggable = true <----- Works like expected when disabled
}
}
- 740
- 6
- 21
This is worked for me!
While uploading apk/bundle first time to play store you might generated private_key.pepk then your key might be also changed. So if you selected default key alias key0 then make sure you selected proper alias then only proceed. If that steps is correct then your bundle will be upload successfully.
- 202
- 2
- 3
I got the same error : enter image description here
In my case I changed :
android {
compileSdkVersion 30
with
android {
compileSdkVersion 31
and
targetSdkVersion 30
with
targetSdkVersion 31
and it worked. Hope it will work for you.
- 2,883
- 4
- 11
- 30
if you lost your upload-keystore.jks file then either you have to reset the upload signing key or create a new app with new app bundle. for reset the upload the key-store.jks follow the link below.He has explained very nicely how to do that. reset the signing key
- 61
- 3
Wowwww it it took me so long to understand why it is not working....
I changed the app key and send it to google and thy sent me to do: " Follow the instructions in the Android Studio Help Center to generate a new key. It must be different from any previous keys. Alternatively, you can use the following command line to generate a new key: keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
This key must be a 2048 bit RSA key and have 25-year validity. Export the certificate for that key to PEM format: keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks
Reply to this email and attach the upload_certificate.pem file. "
i did it and the 1 thing that miss is to change in my keyAlias in the build.gradle to upload ♂️
- 11
- 2
-
can you please tell me after making .jks file how you did settings, because before that we made .keystore files but this is different, what settings we need to do in gradle.properties and build.gradle. – Bilal Yaqoob Jun 08 '22 at 01:36
I have tried nearly everything that for a moment thought it must have been easier. This is for new releases If it is a new release just ignore it, create a new release ( create a new app ) and make sure you choose a different package name. This time also make sure there is nothing left between the folder you copied and new project
- 83
- 1
- 9
I am using expo to build my app bundle. In my case, I had to:
- Manually create a new keystore file.
Or download your existing keystore using commandexpo fetch:android:keystore - Download the Upload certificate of my app from Google Play Console
- Import the Upload certificate of the app into the newly created keystore file, giving it a key alias and a password. This is easily done using the java keytool. In MacOS is in the path so issue a
keytool -hto see the various commands available. - run
expo ba -c, took the manual route and when asked, I specified the keystore file I created in step 1.
- 1,658
- 1
- 15
- 24
If you are using Fastlane, just check that you are actually typing the right passwords.
When trying to run the flow to upload to the play store, I was typing wrong the passwords for the signing store and alias key.
- 1,206
- 1
- 15
- 27
If you are publishing app to playstore and find error Your Android App Bundle is signed with the wrong key. Ensure that your app bundle is signed with the correct signing key and try again:
Then,
If you have not generated/changed app bundle or rebuild/clean project before reaching the current state displayed in pic then make sure to make new app project on play console as play console might be mixing the two keys.
image
- 637
- 4
- 24
It Worked for me with this solution I rebuild the project in Android Studio then i changed the version code, and export the project with new keystore in my console i deleted the release and create a new release and it worked good



