eclipse “由于应用程序签名不同,重新安装失败” - 可以覆盖吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5841946/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Re-installation failed due to different application signatures" - possible to override?
提问by TomaszRykala
I am developing my app on two PCs so obviously I get the error in Eclipse "Re-installation failed due to different application signatures" when trying to deploy on the physical device which has a copy of the app from the other machine.
我正在两台 PC 上开发我的应用程序,所以很明显我在 Eclipse 中收到错误“由于不同的应用程序签名而重新安装失败”,当我尝试在具有另一台机器的应用程序副本的物理设备上进行部署时。
My question is: is it possible to override this, meaning to deploy the app DESPITE different signatures?
我的问题是:是否可以覆盖这一点,这意味着部署应用程序,尽管有不同的签名?
The reason is that my app has a database which I don't want to wipe, because I am fixing a bug relating to it. Is there a quick fix that doesn't require uninstalling the app/copying the keyrstore file between the PCs ? Bet there isn't, but just asking. Thanks!
原因是我的应用程序有一个我不想擦除的数据库,因为我正在修复与它相关的错误。是否有不需要卸载应用程序/在 PC 之间复制密钥库文件的快速修复?打赌没有,但只是问。谢谢!
回答by codinguser
NO, there is no way to override it. From the documentation:
不,没有办法覆盖它。从文档:
When the system is installing an update to an application, it compares the certificate(s) in the new version with those in the existing version. If the certificates match exactly, including both the certificate data and order, then the system allows the update.
当系统安装应用程序更新时,它会将新版本中的证书与现有版本中的证书进行比较。如果证书完全匹配,包括证书数据和顺序,则系统允许更新。
One way to work around this will be to try to sign the apps on both machines with the same keystore. If you are using Eclipse,
解决此问题的一种方法是尝试使用相同的密钥库对两台计算机上的应用程序进行签名。如果您使用的是 Eclipse,
- Go to Preferences -> Android -> Build There you should find the path to the 'Default debug keystore'. (usually something like /Users/username/.android/debug.keystore.
- Copy this file to the new machine.
- Inside Eclipse on the new machine, open Preferences -> Android -> Build
- Enter the path to the file in the field 'Custom debug keystore'
- Save and then you can run your app and have it signed with the same key.
- 转到 Preferences -> Android -> Build 在那里你应该找到“默认调试密钥库”的路径。(通常类似于 /Users/username/.android/debug.keystore。
- 将此文件复制到新机器上。
- 在新机器上的Eclipse里面,打开Preferences -> Android -> Build
- 在“自定义调试密钥库”字段中输入文件路径
- 保存,然后您可以运行您的应用程序并使用相同的密钥对其进行签名。
Good luck
祝你好运
UPDATE:
更新:
It is now possible to configure your signing key in Gradle (which will be used by Android Studio) and include your debug key in source control. Just add the key to your project folder and then add the following to your build.gradle file:
现在可以在 Gradle(将由 Android Studio 使用)中配置您的签名密钥,并将您的调试密钥包含在源代码管理中。只需将密钥添加到您的项目文件夹,然后将以下内容添加到您的 build.gradle 文件中:
signingConfigs {
debug {
storeFile file("../debug.keystore")
}
}
And also add this under build types:
并在构建类型下添加:
buildTypes {
debug {
debuggable true
signingConfig signingConfigs.debug
}
}
See the documentationfor more details
有关更多详细信息,请参阅文档
回答by CommonsWare
My question is: is it possible to override this, meaning to deploy the app DESPITE different signatures?
我的问题是:是否可以覆盖这一点,这意味着部署应用程序,尽管有不同的签名?
Option #1: Uninstall the app, then reinstall.
选项#1:卸载应用程序,然后重新安装。
Option #2: Synchronize your debug.keystore
files between the two machines, so you are signing with the same key in both places.
选项#2:debug.keystore
在两台机器之间同步您的文件,以便您在两个地方使用相同的密钥进行签名。
Is there a quick fix that doesn't require uninstalling the app/copying the keyrstore file between the PCs ?
是否有不需要卸载应用程序/在 PC 之间复制密钥库文件的快速修复?
No, sorry.
不,对不起。