1apply plugin: 'com.android.library' 2 3def props = rootProject.ext 4 5android { 6 compileSdkVersion 21 7 defaultConfig { 8 minSdkVersion 21 9 targetSdkVersion 21 10 versionCode 1 11 versionName "1.0" 12 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 externalNativeBuild { 14 cmake { 15 abiFilters props.abiName 16 targets "ejdb2jni" 17 arguments "-DCMAKE_BUILD_TYPE=Release", 18 "-DBUILD_JNI_BINDING=ON", 19 "-DENABLE_HTTP=OFF", 20 "-DBUILD_EXAMPLES=OFF", 21 "-DCMAKE_TOOLCHAIN_FILE=$ndkDirectory/build/cmake/android.toolchain.cmake", 22 "-DANDROID_ABI=$props.abiName", 23 "-DANDROID_PLATFORM=android-21", 24 "-DANDROID_NATIVE_API_LEVEL=21" 25 } 26 } 27 } 28 externalNativeBuild { 29 cmake { 30 path file("../../../../CMakeLists.txt") 31 } 32 } 33} 34 35project.afterEvaluate { 36 if (tasks.findByName("externalNativeBuildDebug")) { 37 javaPreCompileDebug.dependsOn externalNativeBuildDebug 38 externalNativeBuildDebug.doLast { 39 copy { 40 from(".externalNativeBuild/cmake/debug/$props.abiName/src/bindings/ejdb2_jni/src") { 41 include "ejdb2.jar" 42 } 43 into "libs" 44 } 45 } 46 } 47 if (tasks.findByName("externalNativeBuildRelease")) { 48 javaPreCompileRelease.dependsOn externalNativeBuildRelease 49 externalNativeBuildRelease.doLast { 50 copy { 51 from(".externalNativeBuild/cmake/release/$props.abiName/src/bindings/ejdb2_jni/src") { 52 include "ejdb2.jar" 53 } 54 into "libs" 55 } 56 } 57 } 58} 59 60dependencies { 61 implementation fileTree(dir: "libs", include: ["*.jar"]) 62 testImplementation "junit:junit:4.12" 63 androidTestImplementation "com.android.support.test:runner:1.0.2" 64 androidTestImplementation "com.android.support.test.espresso:espresso-core:3.0.2" 65}