Skip to content

Instantly share code, notes, and snippets.

@ph0b
Last active May 15, 2017 08:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ph0b/418132cb2f3f03a5534c to your computer and use it in GitHub Desktop.
Save ph0b/418132cb2f3f03a5534c to your computer and use it in GitHub Desktop.
gradle configuration for a module depending on a prebuilt native library - using gradle-experimental:0.6.0+ plugin.
apply plugin: 'com.android.model.library'
model {
repositories {
libs(PrebuiltLibraries) {
mydependency {
headers.srcDir "src/main/jni/prebuilts/include"
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file("src/main/jni/prebuilts/${targetPlatform.getName()}/libmydependency.so")
}
}
}
}
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 23
}
}
android.ndk {
moduleName = "mylib"
ldLibs.addAll(['log'])
cppFlags.add("-std=c++11")
cppFlags.add("-fexceptions")
stl = 'gnustl_shared'
platformVersion = 15
}
android.sources {
main {
jni {
dependencies {
library "mydependency" linkage "dynamic"
}
}
}
}
}
@ph0b
Copy link
Author

ph0b commented Nov 25, 2015

cc @proppy
thanks to @rschiu for the pointers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment