How to build a part of Android AOSP?

Andrei Golubev picture Andrei Golubev · Jan 4, 2014 · Viewed 11.1k times · Source

I am trying to build my own libs and apps in external directory of the AOSP, but the problem is i have to run make each time and the make will compile/build whole the android. In my external apps folder i have Android.mk file, but i cannot build it using ndk-build, it will look for JNI folder and NDK_BUILD_PATH, so the question is:

How can i build it without rebuilding whole AOSP?

Answer

Magnus Bäck picture Magnus Bäck · Jan 6, 2014

A plain make invocation will not rebuild more than necessary, but even with a leaf library or binary even an incremental build can take a few minutes. If you only want to build your particular module you can look at the functions briefly documented at the top of build/envsetup.sh. Specifically, the m and mm shell functions should be useful as they only build one or more modules without caring about their dependencies and without even trying to read all Android.mk files found in the tree. Using them should speed up incremental builds significantly (but all dependencies must have been built at some point, i.e. they're only useful for incremental builds).

build/envsetup.sh also defines a number of other shell functions that are useful for building the Android platform and working with its source code.