After compiling the apk in the android4.0 source code, when installing with adb install (or adb install -r reinstall), an error [INSTALL_FAILED_DEXOPT] is reported.
xu@xu-PC :~$ adb install workspace/out/target/product/generic/system/app/xxx.apk
2820 KB/s (225970 bytes in 0.078s)
pkg: /data/local/tmp/xxx.apk
Failure [INSTALL_FAILED_DEXOPT]
or
xu@xu-PC :~$ adb install -r workspace/out/target/product/generic/system/app/xxx.apk
2768 KB/s (225970 bytes in 0.079s)
pkg: /data/local/tmp/xxx.apk
Failure [INSTALL_FAILED_DEXOPT]
This is because the apk under system\app is optimized, and the dex file will not be packaged into the apk. The dex file will be optimized to generate an odex file .
The following are the two files .odex and .apk generated under workspace/out/target/product/generic/system/app/ after the program is compiled
Install: out/target/product/generic/system/app/xxx.odex
Install: out/target/product/generic/system/app/xxx.apk
When installing the apk in this way, the dex file will be missing, resulting in an error [INSTALL_FAILED_DEXOPT].
–>Solution:
Find the unoptimized apk, that is , find the corresponding APP under out/target/product/generic/obj/APPS/ :
xu@xu-PC:~$ adb install workspace/out/target/product/generic/obj/APPS/xxx_intermediates/package.apk.unaligned
2400 KB/s (331697 bytes in 0.134s)
pkg: /data/local/tmp/package.apk.unaligned
Success
xu@xu-PC:~$
If you have already installed the program, you can reinstall it:
xu@xu-PC:~$ adb install -r workspace/out/target/product/generic/obj/APPS/xxx_intermediates/package.apk.unaligned
2873 KB/s (331689 bytes in 0.112s)
pkg: /data/local/tmp/package.apk.unaligned
Success
This installs ok!
Similar Posts:
- [Solved] Ubuntu 18.04 installation perf error: WARNING: perf not found for kernel 4.15.0-39
- Exploit completed, but no session was created.
- [Solved] Linux Error: configure: error: C compiler cannot create executables
- error: exportArchive: The data couldn’t be read because it isn’t in the correct format.
- Root permission NPM global installation (- G) will still have insufficient permissions. Please know the parameter unsafe perm
- Error reporting on data type and matrix dimension of eigen
- [Solved] RuntimeError: Model class apps.users.models.UserProfile doesn’t declare an explicit app_label and isn’t in an application in INSTALLED_APPS.
- [Solved] Rsync Error: gid 4294967295 (-1) is impossible to set on…
- error while loading shared libraries libaio.so.1
- Android Studio Error: Application Installation Failed…INSTALL_FAILED_INVALID_APK…