Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- apply plugin: 'com.android.library'
- android {
- compileSdkVersion 21
- buildToolsVersion "21.1.2"
- defaultConfig {
- minSdkVersion 8
- targetSdkVersion 21
- //ndk {
- // moduleName "libandroid_spatialite"
- //}
- testApplicationId "org.spatialite.test"
- testInstrumentationRunner "android.test.InstrumentationTestRunner"
- }
- buildTypes {
- release {
- }
- }
- // This tricks Gradle that there is no native source code to build,
- // so we can build it with our custom task "ndkBuild"
- sourceSets.main.jni.srcDirs = []
- splits {
- abi {
- enable true
- reset()
- include 'x86', 'armeabi', 'armeabi-v7a'
- universalApk false
- }
- }
- }
- // Howto "Using custom Android.mk with Gradle/Android Studio"
- // http://blog.gaku.net/ndk/
- // http://blog.gaku.net/including-ndk-produced-so-file-into-apk/
- // https://github.com/twitter-university/FibonacciNativeProject/tree/master/FibonacciNative
- // http://ph0b.com/android-studio-gradle-and-ndk-integration/
- task ndkBuild(type: Exec, description: 'Compile JNI sources via NDK') {
- commandLine 'ndk-build',
- 'V=1',
- '-j', Runtime.runtime.availableProcessors(),
- 'NDK_PROJECT_PATH=build',
- 'NDK_APPLICATION_MK=src/main/jni/Application.mk',
- 'APP_BUILD_SCRIPT=src/main/jni/Android.mk'
- }
- task ndkLibsToJar(type: Zip, dependsOn: 'ndkBuild', description: 'Create a JAR of the native libs') {
- destinationDir new File(buildDir, 'libs')
- baseName 'ndk-libs'
- extension 'jar'
- from(new File(buildDir, 'libs')) { include '**/*.so' }
- into 'lib/'
- }
- tasks.withType(JavaCompile) {
- compileTask -> compileTask.dependsOn ndkLibsToJar
- }
- dependencies {
- compile fileTree(dir: new File(buildDir, 'libs'), include: '*.jar')
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement