How to do an android mm clean? How to do an android mm clean? android android

How to do an android mm clean?


Use mm -B, it will rebuild all, equivalent to clean and then make.


Another way to do without mm is to give make clean-<target name> from root of Android source.

Similarly you can build the required module alone with make <target name>


On older make-based AOSP build system, use

mm -B

to rebuild the module.

On newer Ninja+Soong based AOSP build systems, it seems that -B no longer works. It gives the error Unknown option: -B.

One possible alternative is to use the NINJA_ARGS environment variable to pass additional Ninja arguments to underlying build engine.

For example, the following command removes all output and intermediate files:

NINJA_ARGS="-t clean" mm

In this case clean is an extra tool to the Ninja build system. See https://ninja-build.org/manual.html#_extra_tools for other tools.

One thing to notice is that the clean tool seems to clear all the dependencies of the module, instead of the module itself. I haven't found a way to assign a rule to limit the clean scope to the module only.

references: https://android.googlesource.com/platform/build/soong/+/HEAD/docs/best_practices.md