Building separate Android modules with dexpreopt d

2019-03-13 07:09发布

问题:

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'.

回答1:

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 )