Android Hints – building specific platform components

When debugging on android , or hacking elements that don’t exist in the NDK, it might be necessary to just build individual software components to assist in debug or investigation. While the entire OS can be built with a single command, it can take many hours to completely build.What if you don’t need to build everything!?

Android components are built using a vast system of nested makefiles called Android.mk, typically one per folder. The makefile will either set up variables for source code to be processed from that directory level, or contain one or two lines which just identify and call any sub-folders which require processing.

Something which isn’t so obvious, is that every contained software module, be it library, apk, or executatble, has a unique name identifying it in its appropriate makefile. For example, building the AudioFlinger component¬† can be acheived by running the command “build libaudioflinger” from the root directory.

This is because the Android.mk file for this component has a tag called LOCAL_MODULE which a value representing the name for the component. Passing this name as the target to make will request that the make system searches for, and then builds this competent. The resulting component is then copied to <root>/out/target/platform/….. depending on the type of component being built (.so,.apk.exe)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>