I am begineer in Android test. I am trying execute a Junit test, but it crashes when I load a native library.
This is my build.gradle file:
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
minSdkVersion 18
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:24.0.0'
// Unit testing dependencies
testCompile 'junit:junit:4.12'
// Set this dependency if you want to use the Hamcrest matcher library
testCompile 'org.hamcrest:hamcrest-library:1.3'
// more stuff, e.g., Mockito
testCompile 'org.mockito:mockito-core:1.10.19'
}
repositories {
flatDir {
dirs 'libs'
}
}
And when I do
static
{
System.loadLibrary("a");
}
I obtain java.lang.UnsatisfiedLinkError: no a in java.library.path
My test is in "src/test/java"
and my native library in "src/test/jniLibs"
. I suppose than I have to specify Jni libraries path in build.gradle, but how?
Thanks
Aucun commentaire:
Enregistrer un commentaire