问题
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. :-)
回答1:
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).
回答2:
try change debug to release in builds variants
回答3:
This Work for me just change the application id in 'build.gradle(Module: app)' as
defaultConfig {
applicationId 'com.zebra'
}
IF still doesn't understand here's a --> screenshot of image
来源:https://stackoverflow.com/questions/27872959/android-error-app-has-same-packaged-different-signature