This document is based on the code of Android 4.1.1_r6.1 (Jelly Bean).
Suppose that you want to customiz your android system, you may want to modify /system/framework/framework.jar
(source files are in the directory frameworks/base
). During development, let's assume that you just did a full build, and you decide to make some changes to some source files. After that, you want to build again. Ideally, the building system can correctly re-build everything that is dependent on the changes you just made. However, seems that the android building system does not do it properly. You will get an unbootable image caused by mismatched dex signature. If you check the log when system boots, you will see an error message like the following:
07-30 06:50:56.042: I/dalvikvm(393): DexOpt: mismatch dep signature for '/system/framework/framework.odex'
07-30 06:50:56.042: E/dalvikvm(393): /system/framework/apache-xml.jar odex has stale dependencies
The reason is that many system apks which was optimized before (ODEX) need to be rebuilt because they are dependent on system framework jar (but they are not). This causes odex mismatch error at bootup which leads to unbootable android in the worst case.
To solve this problem, you have two options:
-
Set variable
WITH_DEXPREOPT
tofalse
inbuild/target/board/generic/BoardConfig.mk
-
Add
WITH_DEXPREOPT=false
when make. It's like the following:
that's great, thanks for the sharing.