今天调试一个android应用的时候,安装报了Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE错误,代码如下:
[2015-12-28 15:54:31 - MainActivity] ------------------------------
[2015-12-28 15:54:31 - MainActivity] Android Launch!
[2015-12-28 15:54:31 - MainActivity] adb is running normally.
[2015-12-28 15:54:31 - MainActivity] Performing com.runbo.outdoormeter.MainActivity activity launch
[2015-12-28 15:54:31 - MainActivity] Automatic Target Mode: using device 'QCS4BU6HY9C68LY5'
[2015-12-28 15:54:31 - MainActivity] Uploading MainActivity.apk onto device 'QCS4BU6HY9C68LY5'
[2015-12-28 15:54:35 - MainActivity] Installing MainActivity.apk...
[2015-12-28 15:54:36 - MainActivity] Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE
[2015-12-28 15:54:36 - MainActivity] Please check logcat output for more details.
[2015-12-28 15:54:36 - MainActivity] Launch canceled!
好吧,安装不了。因为这个APP是通过系统内置的APP,之前都是直接在linux环境下直接编译该apk再重新push进手机即可,今天我不想这么麻烦,直接在Eclipse下编译再安装该APK就报了这个错误。
使用 adb shell rm system/app/OutdoorMeter/OutdoorMeter.apk 命令将该APK文件删除后,再进行安装还是报相同的错误:Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE
adb shell rm system/app/OutdoorMeter/OutdoorMeter.apk
使用adb uninstall com.runbo.outdoormeter 命令删除该APK文件也删除失败
C:\Documents and Settings\Administrator>adb uninstall com.runbo.outdoormeter
Failure [DELETE_FAILED_INTERNAL_ERROR]
再使用adb shell rm -rf data/data/com.runbo.outdoormeter/ 命令删除data/data/命令下该应用的相关文件
C:\Documents and Settings\Administrator>adb shell rm -rf data/data/com.runbo.outdoormeter/
删除后,再进行安装还是报相同的错误:Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE,安装失败。
使用adb reboot 命令重启后,再安装该APK,安装成功,如下所示:
[2015-12-28 16:12:41 - MainActivity] ------------------------------
[2015-12-28 16:12:41 - MainActivity] Android Launch!
[2015-12-28 16:12:41 - MainActivity] adb is running normally.
[2015-12-28 16:12:41 - MainActivity] Performing com.runbo.outdoormeter.MainActivity activity launch
[2015-12-28 16:12:42 - MainActivity] Automatic Target Mode: using device 'QCS4BU6HY9C68LY5'
[2015-12-28 16:12:42 - MainActivity] Uploading MainActivity.apk onto device 'QCS4BU6HY9C68LY5'
[2015-12-28 16:12:46 - MainActivity] Installing MainActivity.apk...
[2015-12-28 16:12:49 - MainActivity] Success!
[2015-12-28 16:12:49 - MainActivity] Starting activity com.runbo.outdoormeter.MainActivity on device QCS4BU6HY9C68LY5
[2015-12-28 16:12:50 - MainActivity] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.runbo.outdoormeter/.MainActivity }
好吧,总结一下:
第一步:先把原来已经存在的相同包名的APK删除,如:adb shell rm system/app/OutdoorMeter/OutdoorMeter.apk
第二步:将data/data/目录下该应用的包名的目录删除掉,如:adb shell rm -rf data/data/com.runbo.outdoormeter/
第三步:重启Android手机 adb reboot
第四步:再重新安装该APK
====================================================================================
作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!
转载请保留原文地址:http://blog.csdn.net/ouyang_peng
====================================================================================
---------------------
作者:欧阳鹏
来源:CSDN
原文:https://blog.csdn.net/ouyang_peng/article/details/50419276
版权声明:本文为博主原创文章,转载请附上博文链接!