lundi 4 juillet 2016

Android - Gradle build with NDK

I'm not very familiar with NDK and I'm trying to add a project with a jni folder. I followed the Hello-JNI tutorial and I successfully built the apk and test on a device with Android v.5.0.2. But when I try to test it on a device with a 4.4.2 version I get a UnsatisfiedLinkError which I guess it caused by the non-compilation of JNI libs (I had this error before and not anymore after applying the settings of Helloword-JNI in build.gradle). What changes should I make to make the APK working on any device with API>16? Thanks in advance.

build.gradle(project) :

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle-experimental:0.7.2'
}
}

allprojects {
     repositories {
         jcenter()
    }
}

task clean(type: Delete) {
delete rootProject.buildDir
}

build.gradle (module):

apply plugin: 'com.android.model.application'

model {
android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.name.appname"
        minSdkVersion.apiLevel 16
        targetSdkVersion.apiLevel 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles.add(file('proguard-android.txt'))
        }
    }
    ndk {
        moduleName "module 1.0"
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}

Aucun commentaire:

Enregistrer un commentaire