我试着重新安装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.

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

上面的任何东西对我都没用。对我来说,问题是我在android-support-v7-appcompat的Java Build Path中有错误的源代码。进入“项目>生成路径>”时,配置生成路径>。在Source选项卡下,确保你有android-support-v7-appcompat/gen, android-support-v7-appcompat/libs和android-support-v7-appcompat/src,没有其他。单击OK,它应该可以工作。

这是使用adb从设备卸载应用程序的命令:

adb uninstall <package name>

我在编写更新代码时更改了包的名称,这样我就可以通过Eclipse在我的设备上调试它,而不用删除已安装的旧版本。没有恢复我试图重新安装时使用的包名,我得到了同样的错误。使用相同的包名重新安装成功。