我试着重新安装apk

$adb install -r new.apk

它显示了错误:

Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]

一种解决方案是卸载并安装新的。apk,这很好。

但我想知道我是否可以重新构建apk并重新安装而不卸载。如。修改AndroidManifest.xml中的一些配置,或者不签署APK,等等。

如果您能告诉我“INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES”的全部含义,将不胜感激。


当前回答

If you encounter a failed deployment to an Andorid device or emulator with the error "Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]" in the Output Window, simply delete the existing app on the device or emulator and redeploy. Debug builds will use a debug certificate while Release builds will use your configured certificate. This error is simply letting you know that the certificate of the app installed on the device is different than the one you are attempting to install. In non-development (app store) scenarios, this can be indicator of a corrupted or otherwise modified app not safe to install on the device.

其他回答

当团队中的另一名开发人员在我试图部署的硬件设备上构建我们的应用程序时,我就遇到了这种情况。从硬件上卸载应用程序解决了我的问题。

在另一个用例中,我得到了类似的错误。 当我第一次得到错误,我惊慌失措,并删除/data/data/{package.name} 在那之后,我尝试了,但我的问题仍然存在。 然后我尝试卸载,它失败了。

然后我删除了/system/app中的apk文件(需要root访问权限),并尝试卸载,成功了。

之后我试着重新安装apk,它工作了。

只需从设备中删除旧版本并重新安装即可。因为设备。密钥存储库已经存在于设备中,所以只需卸载构建并重新安装APK即可。

谢谢

即使在卸载原始APK之后,我也得到了这个错误,这是令人困惑的。最后我意识到,我在自己的Nexus 7上设置了多个用户进行测试,而其中一个用户仍然安装了该应用程序。一旦我为所有用户卸载它,错误就消失了。

If you encounter a failed deployment to an Andorid device or emulator with the error "Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]" in the Output Window, simply delete the existing app on the device or emulator and redeploy. Debug builds will use a debug certificate while Release builds will use your configured certificate. This error is simply letting you know that the certificate of the app installed on the device is different than the one you are attempting to install. In non-development (app store) scenarios, this can be indicator of a corrupted or otherwise modified app not safe to install on the device.