Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GooglePlay - wrong signing key for app bundle [duplicate]

Tags:

I've just now started using app bundles. I've set the two certificates in the App signing section of the dashboard (signing certificate and upload certificate).

I've built an app bundle and signed it with the upload certificate, but when I upload the bundle under Android Instant Apps (which is in fact the reason I switched to app bundles) it says that:

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: xx:xx:xx:xx.....

I've manually checked the SHA-1 of the upload keystore (using keytool in the terminal) and it matches the xx:xx:xx.... it says in the error message.

What am I doing wrong? The app bundle IS signed with the required upload certificate, but google play doesn't seem to like it.

Ideas?

like image 539
AndreiBogdan Avatar asked Jan 22 '19 19:01

AndreiBogdan


People also ask

How do I change my signing key certificate app?

Step 1:- Go to your Google Play Console and Select your App. Step 2:- Go to Release Section => Setup => App integrity and Click on Request key upgrade.

How do I change my Google Play upload key?

Open Play Console and go to the Play App Signing page (Release > Setup > App integrity). In the “Upgrade your app signing key” card, select Request key upgrade. Select an option to upgrade your app signing key for all new installs. Have Google generate a new app signing key (recommended) or upload one.

How do I get the SHA key from the Google Play Console?

If you've published your app using Play App Signing, a requirement when using Android App Bundle, you can get your SHA-1 from the Google Play Console on the Release > Setup > App Integrity page.


2 Answers

The solution was a very basic one. I had to clean my project and then rebuild it.

Android Studio was signing my app bundle with the old certificate i was using.

What I did previously is go to Build -> Generate Signed Bundle / APK and i changed the jks file in the file selector to the new upload jks. It seems Android Studio caches the old certificate path and uses it even though I've selected a new one. Might be a bug in AS.

So yeah ... now if I clean the project every time i change the jks file it works, the apk or app bundle gets signed with the proper certificate...

like image 156
AndreiBogdan Avatar answered Oct 09 '22 14:10

AndreiBogdan


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:

  1. In android/gradle.properties and android/app/build.gradle, make sure your keystore variables 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             }         }     } } 
  2. In android/app/build.gradle, make sure you set signingConfig to signingConfigs.release in your release buildTypes:
    android {     ...     buildTypes {         debug ...         release {             signingConfig signingConfigs.release         }     } } 

Note: If you're doing react-native development and found yourself here, make sure you follow all steps on "Publishing to Google Play Store". I thought I could skip a few steps without causing problems, and that led to hours of debugging

like image 23
Blundering Philosopher Avatar answered Oct 09 '22 14:10

Blundering Philosopher