问题
There are a lot of examples with adding a whole source folder to paths like a
cppFlags += "-I${file("src/main/jni/native_app_glue")}".toString()
in new experimental gradle plugin for AS 1.3+
Is there a way to add single source file to it?
回答1:
The snippet you're showing is adding an include directory, not sources. It will add headers, not .c/.cpp files.
I haven't found a way to add a single source.
The plugin will look for all the sources inside jni folders. You can add a jni folder using jni.source.srcDirs:
android.sources{
main.jni {
source {
srcDirs += "src/main/other_jni_sources"
}
}
}
来源:https://stackoverflow.com/questions/32818293/how-to-add-a-single-file-to-paths-in-android-studio-1-3-with-experimental-gradl