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"//添加这一句代码就可以了        }    }}

就可以跑起来了

更多相关文章

  1. android 通信机制 socket
  2. Base64编解码Android和ios的例子,补充JNI中的例子
  3. 使用Repo在Windows平台下載Android原始碼
  4. android 开发中遇到的问题
  5. Android(安卓)定位当前位置可能出现的问题
  6. [Android] 升级了新的android studio之后 发生如下的报错,The fol
  7. Android(安卓)中的各种控件
  8. Base64编解码Android和ios的例子,补充JNI中的例子
  9. android Gallery实现加载网络图片

随机推荐

  1. android调用Webservice方法
  2. androidstudio搭建flutter环境,遇到的问题
  3. Android(安卓)Animation学习笔记
  4. android 命令行安装apk
  5. 自己封装的Android(安卓)sqlite-helper.j
  6. Android开发学习:ImageView的scaletype属
  7. Android(安卓)Animation之frame animatio
  8. Android(安卓)网络请求简单使用方式
  9. android控件背景揭密--NinePatch
  10. Android(安卓)Layout属性