0
私はAndroidテストではじまりました。私はJunitテストを実行しようとしていますが、ネイティブライブラリをロードするとクラッシュします。セットアップbuild.gradle Junit Androidテスト
これは私のbuild.gradleファイルです:
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'
}
}
そして、私は
static
{
System.loadLibrary("a");
}
を行うとき、私はjava.lang.UnsatisfiedLinkError: no a in java.library.path
私のテストは"src/test/java"
にあり、"src/test/jniLibs"
の私のネイティブライブラリ得ます。私はbuild.gradleでJniライブラリのパスを指定する必要があると思いますが、どうですか?ここに示されているよう
おかげ