Incremental Install is a way of building & deploying an APK that tries to minimize the time it takes to make a change and see that change running on device. They work best with
is_component_build=true, and do not require a rooted device.
Add the gn arg:
incremental_install = true
This causes all apks to be built as incremental except for blacklisted ones.
It is not enough to
adb install them. You must use the generated wrapper script:
out/Debug/bin/your_apk run out/Debug/bin/run_chrome_public_test_apk # Automatically sets --fast-local-dev
The basic idea is to sideload .dex and .so files to
/data/local/tmp rather than bundling them in the .apk. Then, when making a change, only the changed .dex / .so needs to be pushed to the device.
final_dexstep (where all .dex files are merged into one)
adb installfor code-only changes.
Slower Initial Runs:
DexOptneeds to run on all .dex files. This step is normally done during
adb install, but is done on start-up for incremental apks.
loadable_modulesare not sideloaded (they remain in the apk), so builds & installs that modify any of these are not as fast as those that modify only .java / .cc.
/data/local/tmp, you need to use the wrapper scripts to uninstall them fully. E.g.:
All incremental apks have the same classes.dex, which is built from:
They also have a transformed
AndroidManifest.xml, which overrides the the main application class and any instrumentation classes so that they instead point to
BootstrapApplication. This is built by:
Wrapper scripts and install logic is contained in:
Finally, GN logic for incremental apks is sprinkled throughout.