1.android.useDeprecatedNdk=true
Error:Execution failed for task ':app:compileDebugNdk'.
> Error: NDK integration is deprecated in the current plugin. Consider trying the new experimental plugin. For details, see http://tools.android.com/tech-docs/new-build-system/gradle-experimental. Set "android.useDeprecatedNdk=true" in gradle.properties to continue using the current NDK integration.
該問題是需要在工程目錄下的gradle.properties文件下,加上android.useDeprecatedNdk=true即可
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2.build.gradle少了配置
Warning:Native C/C++ source code is found, but it seems that NDK option is not configured. Note that if you have an Android.mk, it is not used for compilation. The recommended workaround is to remove the default jni source code directory by adding:
android {
sourceSets {
main {
jni.srcDirs = []
}
}
}
to build.gradle, manually compile the code with ndk-build, and then place the resulting shared object in src/main/jniLibs.
make.exe: *** No rule to make target `E:\as_workspaces\IntentDemo\app\build\intermediates\ndk\debug\obj/local/armeabi-v7a/objs/app/E_\as_workspaces\IntentDemo\app\src\main\jni', needed by `E:\as_workspaces\IntentDemo\app\build\intermediates\ndk\debug\obj/local/armeabi-v7a/objs/app/E_\as_workspaces\IntentDemo\app\src\main\jni\JNI_Demo.o'. Stop.
:app:compileDebugNdk FAILED
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3.
make.exe: *** No rule to make target `E:\as_workspaces\IntentDemo\app\build\intermediates\ndk\debug\obj/local/armeabi-v7a/objs/JNI_Demo/E_\as_workspaces\IntentDemo\app\src\main\jni', needed by `E:\as_workspaces\IntentDemo\app\build\intermediates\ndk\debug\obj/local/armeabi-v7a/objs/JNI_Demo/E_\as_workspaces\IntentDemo\app\src\main\jni\JNI_Demo.o'. Stop.
Error:Execution failed for task ':app:compileDebugNdk'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Android\android-ndk-r10\ndk-build.cmd'' finished with non-zero exit value 2
-------------------------------------------------------------------------------
4.關於Eclipse中始終無法編譯通過的問題
如果覺得JNI的代碼都沒有錯,就先clean一下項目清下緩存,然后把命令行窗口關閉,重新再打開。再試一下即可。
-------------------------------------------------------------------------------
5.Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
如果.mk文件里沒有定義APP_PLATFORM android-19,那么會使用默認的。所以加上后,把project.properties里面也改成target=android-19。AndroidManifest.xml里面android:minSdkVersion可以不改
-------------------------------------------------------------------------------
6.Android NDK: LOCAL_MODULE definition in jni/Android.mk must not contain space
這個問題是因為.mk文件里面有空格字符,你可以把里面的中文注釋都去掉,把中文空格都改成英文空格,或者干脆都去掉。
-------------------------------------------------------------------------------
7.
http://www.th7.cn/Program/Android/201509/550864.shtml
http://blog.csdn.net/lamp_zy/article/details/48976737
http://blog.k-res.net/archives/1788.html
http://www.cnblogs.com/flyme/p/4431762.html
http://blog.k-res.net/archives/1788.html