Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.apache.tools.ant.taskdefs.condition.Os
- apply plugin: 'com.android.application'
- android {
- compileSdkVersion 22
- buildToolsVersion "22.0.1"
- defaultConfig {
- applicationId "com.example.gp.ndk"
- minSdkVersion 16
- targetSdkVersion 22
- versionCode 1
- versionName "1.0"
- ndk {
- moduleName "ndkLib"
- }
- sourceSets.main {
- jni.srcDirs = [] //disable automatic ndk-build call
- jniLibs.srcDir 'src/main/libs' //set .so files location to libs
- }
- // call regular ndk-build(.cmd) script from app directory
- task ndkBuild(type: Exec) {
- if (Os.isFamily(Os.FAMILY_WINDOWS)) {
- commandLine 'cmd','ndk-build.cmd', '-C', file('src/main/jni/').absolutePath
- } else {
- commandLine 'ndk-build', '-C', file('src/main').absolutePath
- }
- }
- tasks.withType(JavaCompile) {
- compileTask -> compileTask.dependsOn ndkBuild
- }
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
- }
- dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:22.1.1'
- }
Advertisement
Add Comment
Please, Sign In to add comment