问题描述
我遇到了 android studio 所说的问题
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. . . ..
这是正确的,因为我最近签署了一个 APK 并上传到我的 Play 开发者控制台的测试区.
This is correct, as I recently signed an APK and uploaded to the beta area of my play developer console.
现在我正在尝试在本地调试它,默认情况下我相信所有 Android 项目都由调试密钥库签名,因此签名会有所不同.
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. :-)
推荐答案
您可以在保留调试选项的同时使用您的发布密钥签署您的应用程序 - 您只需要将您的发布密钥添加到 Android Studio(或在命令中指定它)如果您在那里签署您的应用程序).
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).
在 Android Studio 中,在项目浏览器中右键单击您的应用并打开模块设置.选择您的应用程序模块,然后单击签名"以确保列出了您的发布密钥库.然后在构建类型"下,确保调试目标和发布目标共享相同的签名配置,并且调试目标的 debuggable 设置为 true.他们现在应该共享相同的密钥.
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).
这篇关于Android:错误 - 应用程序具有相同的打包不同签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!