build.gradle相当于:
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include/ \
$(LOCAL_PATH)/lib/ \
$(LOCAL_PATH)/libcharset \
$(LOCAL_PATH)/libcharset/include/ \
可以在Android.mk中找到。
我尝试了各种形式的jni.source.srcDirs
文档定义:
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
}
android.ndk {
moduleName = "native"
}
android.sources {
main {
jni {
source {
srcDir 'src'
}
}
}
}
}
然而,等价物找不到包含:
android.sources {
main {
jni {
source {
srcDirs += '/src/main/jni/libiconv'
srcDirs += "/src/main/jni/libiconv/include"
srcDirs += "/src/main/jni/libiconv/lib"
srcDirs += "/src/main/jni/libiconv/libcharset"
srcDirs += "/src/main/jni/libiconv/libcharset/include"
}
}
}
}
OR:
android.sources {
main {
jni {
source {
srcDirs = ["/src/main/jni/libiconv",
"/src/main/jni/libiconv/include",
"/src/main/jni/libiconv/lib",
"/src/main/jni/libiconv/libcharset",
"/src/main/jni/libiconv/libcharset/include" ]
}
}
}
}
答案 0 :(得分:1)
srcDirs仅用于指定源。 DSL不支持直接指定包含的方法,但您可以使用cppFlags:
android.ndk {
//...
cppFlags += "-I${file("src/main/jni/libiconv/include")}".toString()
//...
}