Building separate Android modules with dexpreopt disabled

10,459

Apparently the WITH_DEXPREOPT environment variable is overwritten by an internal WITH_DEXPREOPT variable in

build/target/board/generic/BoardConfig.mk

Changing this to false, or according to the people at google groups, starting a make with:

make showcommands WITH_DEXPREOPT=false

does the trick. Building a specific module and making a new system image now results in a bootable build.

(source: https://groups.google.com/d/topic/android-building/vJCkg8Yq9Ic/discussion )

Share:
10,459
b74ckb1rd
Author by

b74ckb1rd

Updated on July 19, 2022

Comments

  • b74ckb1rd
    b74ckb1rd almost 2 years

    For my thesis, I'm modifying the android framework and building the source (4.1.1 Jelly Bean). I can do a full build, but because this is very time consuming (I'm developing on a ubuntu 12.04 64bit virtual machine) I'd like to build separate modules.

    For example: When doing changes to the location modules, it should be possible to just build the changed module, and make a new system image:

    mmm frameworks/base
    make snod
    

    But this doesn't work. Every time I try to boot, the new system image won't boot because of:

    I/dalvikvm( 1696): DexOpt: mismatch dep signature for '/system/framework/framework.odex'
    

    After some research, I tried to disable dexpreopt with the enviroment variables

    export $WITH_DEXPREOPT=false 
    

    and

    export $DISABLE_DEXPREOPT=true 
    

    and doing a full rebuild with 'make installclean'. The full rebuild works, and the changes to the framework are present in the build. But after doing a new change, still 'mmm frameworks/base' and 'make snod' result in dexpreopt mismatch.

    The build/core/makefile from 'make snod' also gives the warning: 'Warning: with dexpreopt enabled, you may need a full rebuild.', which comes from this line in the makefile:

    ifeq (true,$(WITH_DEXPREOPT))
    $(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
    endif
    

    This leads me to believe the $WITH_DEXPREOPT variable isn't correctly set or read? So far I haven't been able to get a bootable system image without doing a clean full rebuild. Is the procedure I follow the correct to disable dexpreopt, or are there any other ways to build separate modules after doing changes to the framework and getting a new system image?

    Build target is 'full-eng'.

  • Admin
    Admin over 11 years
    Thanks! For some reason changes in the source code was not being reflected in the emulator even after a clean rebuild. Setting the variable after a make clean and install corrected it. However, when I made another change to the code, used mmm framework/base, and then make snod, the emulator would not boot (meaning it was stuck on the "android" screen"). What were your exact commands subsequent to a clean build using make showcommands WITH_DEXPREOPT=false? Did you use make snod at all or continuously use WITH_DEXPREOPT=false every time you made changes?
  • b74ckb1rd
    b74ckb1rd over 11 years
    I didn't test it using the make showcommands WITH_DEXPREOPT=false command, I just changed it in BoardConfig.mk and did a make clean and a full rebuild. From this point making changes in for example the Location module persisted in the build after a 'mmm frameworks/base' and 'make snod'. If your emulator does not boot, check using 'adb logcat' to pinpoint the problem.
  • psykid
    psykid over 5 years
    is there anyway possible to confine this change for a list of specific apps? (I am not looking for the LOCAL_DEXPREOPT solution which is to be done in each app's mk file separately).