When building Lollipop, I could compile my changes by running:
make clean-framework clean-services clean-services.core services.core services framework && make snod
However, this is not reliable for Marshmallow. Sometimes it works, and other times my changes will not be compiled. I have also seen this produce an unbootable build, forcing me to do a full make -j8
, which takes almost an hour on my machine.
Am I missing a new build target? Any advice is greatly appreciated.
Thanks.
The reason my partial builds failed to boot was due to dex pre-optimization
. When dexpreopt is enabled, you cannot recompile certain parts of the system image, since they are byte-aligned and optimized together at compile time. After disabling dexpreopt, and doing a make clobber && make -j6
, I was able to do partial builds with no issues.
To disable dexpreopt, set the following variables in your terminal:
export WITH_DEXPREOPT=false
export DISABLE_DEXPREOPT=true
TIP: add the above to your build/envsetup.sh
or your .bashrc
so you don't have to remember each time.
TIP 2: There is also a DONT_DEXPREOPT_PREBUILTS
, but I have never had a problem with that, so I leave it set to the default, which isfalse
. If you set this variable to true
, it will take an incredibly long time (easily over an hour) for the device to boot after your flash it, since it has to optimize everything first.