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

其他回答

这意味着应用程序的新副本(在开发机器上)与应用程序的旧副本(安装在设备/模拟器上)使用不同的签名密钥进行签名。例如,如果这是一个设备,您可能已经从不同的开发机器(例如,其他开发人员的机器)上放置了旧的副本。或者,旧的用您的生产密钥签名,新的用您的调试密钥签名。

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.

我认为,你的应用程序是由其他账户安装的。(多账号模式特性)您可以在“设置>应用程序>“应用程序名称”>卸载应用程序

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

我今天也犯了同样的错误,但问题不是完全一样的。我正在使用ADB和安装在VirtualBox中的Android。我尝试安装我的应用程序的不同版本(有签名/没有签名,调试/发布模式),得到了两个错误:INSTALL_FAILED_UID_CHANGED和INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES。

现在,当查看/data/data/{package.name}时,我发现卸载应用程序后仍然存在一堆文件。我试图rm -rf它们,但没有成功:我得到了I/O错误。

解决办法是:

关闭虚拟机 使用vdfuse挂载VDI映像(读/写) 使用e2fsck修复Partition1映像文件 Umount并重启虚拟机