Android(安卓)导入项目时遇到的JNI和NDK问题
16lz
2022-04-07
android studio在导入一些调用C/C++的android项目时,会遇到有关JNI的问题,例如导入下面这个项目
https://github.com/handheldgroup/android-serialport-api
会遇到这样的问题
Error:(12, 0) 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.
这个问题的解决办法在这
http://stackoverflow.com/questions/31979965/after-updating-android-studio-to-version-1-3-0-i-am-getting-ndk-integration-is
按照上面完成之后可以编译通过了,但是run一下会出现下面的问题
Error:(97) undefined reference to `__android_log_print'
网上各种找资料,试了很多方法之后都没用,最后用这个里面的第三个回答解决了
http://stackoverflow.com/questions/4455941/undefined-reference-to-android-log-print
回答里面的前两种我也试了,都不行,第三种修改Android.mk
android { defaultConfig { ndk { moduleName "your_module_name" ldLibs "log"//添加这一句代码就可以了 } }}
就可以跑起来了
更多相关文章
- android 通信机制 socket
- Base64编解码Android和ios的例子,补充JNI中的例子
- 使用Repo在Windows平台下載Android原始碼
- android 开发中遇到的问题
- Android(安卓)定位当前位置可能出现的问题
- [Android] 升级了新的android studio之后 发生如下的报错,The fol
- Android(安卓)中的各种控件
- Base64编解码Android和ios的例子,补充JNI中的例子
- android Gallery实现加载网络图片