1
我正在學習android.I中的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