今天调试一个android应用的时候,安装报了Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE错误,代码如下:
1
2
3
4
5
6
7
8
9
10
|
[
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
1
|
adb shell rm system/app/OutdoorMeter/OutdoorMeter.apk
|
使用adb uninstall com.runbo.outdoormeter 命令删除该APK文件也删除失败
1
2
|
C:\Documents and Settings\Administrator>adb uninstall com.runbo.outdoormeter
Failure [DELETE_FAILED_INTERNAL_ERROR]
|
1
|
C:\Documents and Settings\Administrator>adb shell rm -rf data/data/com.runbo.outdoormeter/
|
使用adb reboot 命令重启后,再安装该APK,安装成功,如下所示:
1
2
3
4
5
6
7
8
9
10
|
[
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