I would like to know whether it is possible to define LOCAL_SRC_FILES in gradle.build ndk {} block.
I am currently using:
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
in my top level gradle.build file.
My jni module gradle.build file looks like this:
apply plugin: 'com.android.library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 11
buildToolsVersion "22.0.1"
def jniSrc = System.getProperty("user.home") + "/srcs/jni"
defaultConfig {
ndk {
moduleName "core"
stl "gnustl_shared"
cFlags "-std=c++11"
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
jni.srcDirs = ["${jniSrc}"]
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
jniDebuggable true
}
}
productFlavors {
x86 {
ndk {
abiFilter "x86"
}
}
arm {
ndk {
abiFilter "armeabi-v7a"
}
}
mips {
ndk {
abiFilter "mips"
}
}
}
}
The reason I am asking is that under my jni sources there is code targeting different platforms, not just Android, but also iOS and WinRT.
I am a bit reluctant to migrate to experimental 'com.android.tools.build:gradle-experimental:0.2.0' but if the aforementioned module solves the problem I could give it a try.
I also wouldn't like to use:
jni.srcDirs = []
and override the creation of Android.mk and thus use my own custom one, given that I am not sure if I could debug C++ natively from Android Studio thereafter (I could be wrong here though, I am definitely not an expert user of Android Studios ndk plugin).
Many thanks in advance,
Manos