1
私はアンドロイドでndkを学習しています。問題があります。 ここにエラー情報があります: エラー:タスク ':app:compileDebugNdk'の実行に失敗しました。ndkがゼロ以外の終了値で終了しました69
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/yishuaiqin/Documents/adt-bundle-mac-x86_64-20140702/sdk/ndk-bundle/ndk-build'' **finished with non-zero exit value 69**
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.yishuaiqin.myapplication"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
ndk{
moduleName "JniDemo"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
}
私は
sourceSets.main {
res.srcDirs = ['src/main/res']
jniLibs.srcDirs = ['src/main/JniDemo']
jni.srcDirs = [] // This prevents the auto generation of Android.mk
}
を追加しようとしましたが、私はこの、別のエラーが発生します:
FATAL EXCEPTION: main
Process: com.example.yishuaiqin.myapplication, PID: 19774
java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-support-annotations-23.4.0_a08614bb6283cfa324b87685191afbfb59aca883-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-internal_impl-23.4.0_d3bbf4c848f2f380fb4656d172d460d67e20c13a-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-com.android.support-support-vector-drawable-23.4.0_349aae7a307baa89345a2ee68f546bcfc06d7dcb-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-com.android.support-support-v4-23.4.0_1345311585f1d2a3e686ce5b1400b7695dd6eb16-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-com.android.support-appcompat-v7-23.4.0_f833b9499bab0649a8dfe39f8821365db78812c6-classes.dex", dex file "/data/data/com.example.yishuaiqin.myapplication/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-23.4.0_1ce53af57ba1082cd25ff52df7ce61dddbd9cdad-classes.dex"],nativeLibraryDirectories=[/data/app/com.example.yishuaiqin.myapplication-1/lib/x86, /vendor/lib, /system/lib]]] couldn't find "libJniDemo.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:1076)
at com.example.yishuaiqin.myapplication.NdkTest.<clinit>(NdkTest.java:10)
at com.example.yishuaiqin.myapplication.MainActivity.onCreate(MainActivity.java:14)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
私は他で解決策を試してみました答えは、しかし私を助けません。 誰もが考えている?事前に感謝します。
この問題を解決する最善の方法は、Android Studioの限定されたNDKサポートを無効にし、gradleスクリプトからndk-buildを呼び出すことです。 – khakishoiab
上記のオプションで作業チェックができない場合、ndkのlocal.propertiesのパスは 'ndk.dir = C \:\\ Users \\ admin \\ AppData \\ Local \\ Android \\ ndk'のように設定されています。 – khakishoiab