I pretty much read through almost every question in stackoverflow about the subject. I browsed documentation and work-notes of other people who are using AS + NDK + gradle to build an aar that would be included by other app.
I was able to build the .so in a different multi-project setup where the structure was different from the one shown in one aspect: it didn't have the first jni/ layer.
I added that extra jni layer so that I'd have a sharedObjectLib#2/ hierarchy. In that jni/ dir, all i have is a single Android.mk whose sole purpose is to include $(call all-subdir-makefiles). After I did that, gradle build reports the NDK failure:
"Error:(89) Android NDK: WARNING: There are no modules to build in this project!"
What I can't seem to be able to do is build multiple shared objects '.so' as part of the aar.
I would really like to know if (a) it is doable; and (b) some pointers to links and/or examples of gradle.build files that actually do that.
Here is the structure I currently have - skipping the usual directories created by Android Studio (v. 1.2.2, btw).
--rootProject/
--build.gradle
--gradle.properties
--local.properties
--settings.gradle
--rootProject.iml
--app/
--moduleProjectThatBuildsAAR/
--build.gradle
--build/
--libs
--src/
--main/
--res/
--AndroidManifest.xml
--jni/
--Android.mk (does include $(call all-subdir-makefiles))
--Application.mk
--sharedObjectLib#1/
--build.gradle
--src/
-- androidTest/
-- main/
--java/
--jni/
-- Android.mk
-- Application.mk
-- *.c and *.h files
--libs/
--obj/
-- build.gradle
It's pretty convoluted and I am hoping the experts would help with simplification.
thanks!