13

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

TigerhawkT3
  • 44,764
  • 6
  • 48
  • 82
Martin
  • 22,234
  • 53
  • 190
  • 309

4 Answers4

27

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).

Aaron D
  • 6,424
  • 3
  • 38
  • 45
1

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.

Anthony
  • 1,053
  • 1
  • 13
  • 14
0

try change debug to release in builds variants

vitalinvent
  • 305
  • 1
  • 3
  • 9
-2

changing the app id in gradle files did it for me

    defaultConfig {
    applicationId 'com.example.app'
    }
UnBanned
  • 83
  • 10