您的位置:首页 > 移动开发 > Android开发

[android ndk] -android studio中编译生成so文件

2016-01-29 10:48 465 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: