[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
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
相关文章推荐
- Android学习路线指南
- Android实战技巧之十九:android studio导出jar包(Module)并获得手机信息
- Android studio使用lambda表达式
- 日积月累--android基础知识日记
- AndroidStudio使用开源框架PhotoView
- Android四大组件之Activity
- android jni的使用,java中代码在native层实现
- Android WiFi
- android notification
- android中生成excel
- Xamarin开发Android之VisualStudio设置
- Android Bitmap太大导致ImageView不显示的问题
- Android源码下载同步指导
- android Java heap space
- android程序的完美退出
- Android倒计时原理的实现
- Android相机开发那些坑
- Android 三种方式实现圆形ImageView
- 【团队分享】刀锋铁骑:常见Android Native崩溃及错误原因
- android studio创建桌面插件widget