1

I'm new to JNI, C++ and make files. In the Application.mk of my sample Android-JNI-C++ project their is a APP_MODULES property.

The Android NDK documentation just says

APP_MODULES

This variable is optional. If not defined, the NDK will build by default all the modules declared by your Android.mk, and any sub-makefile it may include.

If APP_MODULES is defined, it must be a space-separated list of module names as they appear in the LOCAL_MODULE definitions of Android.mk files. Note that the NDK will compute module dependencies automatically.

And I know from other questions on StackOverflow, that each module needs it's own Android.mk.

But what is a module in this context? What is the advantage of having several modules instead of having only one?

Community
  • 1
  • 1
Christian Strempfer
  • 7,291
  • 6
  • 50
  • 75
  • It is same as having different building blocks. You can have conditional compilation of modules as well as conditional compilation within the modules, improve compilation times when you make a small change. – auselen Feb 01 '13 at 13:43

1 Answers1

1

You can have many modules defined in a single Android.mk. Each library - static or shared - you build or copy (that's called prebuilt lib) is a separate module.

The main reason to split the code in separate libraries on Android is the same as on all other platforms: divide et impera. In the NDK build scheme, there is one more case: it's much easier to specify compilation parameters per module, so if you need to mix -std=c99 and -std=c++0x, the simple workaround is to use two static libraries.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307