简体   繁体   English

“由于不同的应用程序签名,重新安装失败” - 可以覆盖吗?

[英]“Re-installation failed due to different application signatures” - possible to override?

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?是否有不需要卸载应用程序/在 PC 之间复制 keyrstore 文件的快速修复? Bet there isn't, but just asking.打赌没有,但只是问。 Thanks!谢谢!

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,

  1. Go to Preferences -> Android -> Build There you should find the path to the 'Default debug keystore'. Go 到 Preferences -> Android -> Build 在那里你应该找到'Default debug keystore'的路径。 (usually something like /Users/username/.android/debug.keystore. (通常类似于 /Users/username/.android/debug.keystore。
  2. Copy this file to the new machine.将此文件复制到新机器。
  3. Inside Eclipse on the new machine, open Preferences -> Android -> Build在新机上Eclipse里面,打开Preferences -> Android -> Build
  4. Enter the path to the file in the field 'Custom debug keystore'在“自定义调试密钥库”字段中输入文件的路径
  5. Save and then you can run your app and have it signed with the same key.保存,然后您可以运行您的应用程序并使用相同的密钥对其进行签名。

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.现在可以在 Gradle(将由 Android Studio 使用)中配置您的签名密钥,并将您的调试密钥包含在源代码控制中。 Just add the key to your project folder and then add the following to your build.gradle file:只需将密钥添加到您的项目文件夹,然后将以下内容添加到您的 build.gradle 文件中:

signingConfigs {
        debug {
            storeFile file("../debug.keystore")
        }
    }

And also add this under build types:并在构建类型下添加:

buildTypes {        
    debug {
        debuggable true
        signingConfig signingConfigs.debug
    }
}

See the documentation for more details有关更多详细信息,请参阅文档

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 之间复制 keyrstore 文件的快速修复?

No, sorry.不,对不起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM