Android: Error - App has same packaged different signature
Asked Answered
K

5

19

I am getting an issue where android studio is saying

 Installation failed since the device has an application with the same package but a different signature. . . .. 

This is correct, as I recently signed an APK and uploaded to the beta area of my play developer console.

And now I am trying to debug it locally and by default I believe that all Android projects are signed by the debug keystore hence the signatures would be different.

What is the best way to deal with this? Would it be possible to sign my debug version with my release key, and is there a potential danger here?

How would I force the signing of my debug version with my release keystore without losing the ability to debug, etc.?

Or should I just keep uninstalling and reinstalling the different versions - that seems the worst possible workaround. :-)

Kenyettakenyon answered 10/1, 2015 at 4:48 Comment(0)
S
36

You can sign your apps with your release key while keeping the debugging option - you just have to add your release key into Android Studio (or specify it on the command line if you are signing your apps there).

In Android Studio, right click on your app in the project browser and open module settings. Select your app's module and click on 'Signing' to make sure your release keystore is listed. Then under 'Build Types', make sure that the debug target and the release target share the same signing config, and that the debug target has debuggable set to true. They should now share the same key.

More information on app signing can be found in the Developer docs here.

I haven't heard of a downside to using the same key for debugging and for release, provided the private key is kept secure (read: not under version control).

Stans answered 10/1, 2015 at 5:1 Comment(1)
Hey, I tried to follow along but I don't see "Signing" button, only "Signing Config" tab. I tried to set it up but it didn't work. Help?Anthelion
C
7

In my case after upgrading Android Studio, I had removed the $HOME/.android folder which made Android Studio create a new $HOME/.android/debug.keystore. After copying the old debug.keystore it worked again.

Collateral answered 7/1, 2021 at 9:51 Comment(2)
Good thing I had a backup of that folder before I carelessly blew it away!Bonedry
I moved my old machine $HOME/.android/debug.keystore (where i was developing) to new machine and it worked, thanksEndamoeba
M
0

try change debug to release in builds variants

Meantime answered 27/9, 2019 at 13:41 Comment(0)
C
0

In my case, the problem was fixed by adding the SHA-1 and SHA-256 certificate fingerprints given in Android Studio (click on Gradle on the right side of the AS window, then run configurations and signingReport) to your Firebase project settings->General->SDK setup and configuration.

By the way, this also solved the problem I was getting logging in and getting the cryptic error Activity.RESULT_CANCELED.

Consolidation answered 17/2, 2022 at 9:24 Comment(0)
D
-2

changing the app id in gradle files did it for me

    defaultConfig {
    applicationId 'com.example.app'
    }
Dygall answered 30/1, 2020 at 21:23 Comment(1)
Not a good solution since you still want android to acknowledge it's the same appAnthelion

© 2022 - 2024 — McMap. All rights reserved.