Failure [INSTALL_FAILED_DEXOPT]

在android4.0源码里面编译出来apk后,用adb install 安装时,报错[INSTALL_FAILED_DEXOPT]。

z:\ics-android\ics-src\out\target\product\generic\system\app>adb install NativeTimer.apk

28 KB/s (10166 bytes in 0.344s)
        pkg: /data/local/tmp/NativeTimer.apk

Failure [INSTALL_FAILED_DEXOPT]


原来在system\app下面的apk是经过优化的,而dex文件不会打包到apk中,dex文件会被优化后,生成odex文件。

z:\ics-android\ics-src\out\target\product\generic\system\app\NativeTimer.apk

z:\ics-android\ics-src\out\target\product\generic\system\app\NativeTimer.odex

这样安装apk时,就会缺少dex文件,导致报错[INSTALL_FAILED_DEXOPT]。


解决办法:

找到未优化过的apk,即

z:\ics-android\ics-src\out\target\product\generic\obj\APPS\NativeTimer_intermediates>adb install package.apk.unaligned
70 KB/s (138806 bytes in 1.912s)
        pkg: /data/local/tmp/package.apk.unaligned
Success

你可能感兴趣的:(Failure [INSTALL_FAILED_DEXOPT])