Developer110
Developer110

Reputation: 182

updating my android application with android studio

I had built an android application in eclipse. I have stored the keystore and key alias after publishing it. Now I have imported it in Android Studio, updated the source code. And I want to publish the update on play store, but unfortunately it is not accepting. The message is :

Upload failed

You uploaded an APK that is signed with a different certificate to your previous APKs. You must use the same certificate. Your existing APKs are signed with the certificate(s) with fingerprint(s): [ SHA1: 01:C0:25:50:B5:86:5A:6F:E0:7D:67:4F:84:12:47:5F:3F:33:A2:51 ] and the certificate(s) used to sign the APK you uploaded have fingerprint(s): [ SHA1: CD:DE:F8:94:2C:EF:D7:DE:59:62:8E:63:B3:38:D5:32:1B:FF:37:A9 ]

Do I need to add the following code in my app module?

defaultConfig { ... }
signingConfigs {
    release {
        storeFile file("myreleasekey.keystore")
        storePassword "password"
        keyAlias "MyReleaseKey"
        keyPassword "password"
    }
}

Any help is really appreciated. Thanks

Upvotes: 1

Views: 244

Answers (1)

NoChinDeluxe
NoChinDeluxe

Reputation: 3444

What I do to sign my release APKs is drop a copy of the actual relase.keystore file into the root of my project, then sign with command line. If you do it this way, you'll be 100% sure that you are signing your app with the actual keystore you signed it with in Eclipse.

So copy and paste a copy of your release.keystore file into the root of your Android Studio project, then using command line navigate to that directory, then run this command:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore your_release_key.keystore app/build/outputs/apk/your_unsigned.apk your_release_key_alias

This assumes you have the jarsigner added to your PATH environment variable. Also, you'd obviously replace the file names with the actual file names of your keystore and your apk.

Hope this helps!

Upvotes: 2

Related Questions