0
多くの類似の質問がありますが、わかりません。は、Androidスタジオに.soを含むビルド:Gradle:2.1.0
私はbuild.gradle内でndk-buildを統合することができましたが、私の.apkに.soが含まれていないようです。私は自分のアプリケーションの実行時に
|--app: |--|--src: |--|--|--main |--|--|--java |--|--|--libs |--|--|--|--|--armeabi |--|--|--|--|--|--.so Files
ネイティブ関数を呼び出すときに、私はjava.lang.UnsatisfiedLinkError:
を取得...
:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "masterproject.student_at_university_kiel.knauf.torsten"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// for preventing (cheating) gradle-build to overwrite Android.mk with auto-generated Android.mk (NdkCompile task)
sourceSets.main {
jni.srcDirs = [] //disable automatic ndk-build call
jniLibs.srcDir 'src/main/libs/' //integrate your libs from libs instead of jniLibs
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
task ndkBuild(type: Exec) {
def ndkDir = "/home/expert/Android/Sdk/ndk-bundle"
workingDir "src/main/jni"
commandLine "$ndkDir/ndk-build"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
}
、これは次のディレクトリ構造につながる:ここに私のbuild.graldeです以下のような多くのことを発見した:
task nativeLibsToJar(type: Jar, description: 'create a jar archive of the native libs') {
destinationDir file("$buildDir/native-libs")
baseName 'native-libs'
from fileTree(dir: 'libs', include: '**/*.so')
into 'lib/'
}
しかし、私はそれを理解していないと、それはCに私には不要な感じネイティブコード用の.jarアーカイブをリベートします。それとも私は何かを完全に逃したのですか?
ありがとうございます!