星空网 > 软件开发 > 操作系统

Android jni开发中的常见错误

错误1:java.lang.UnsatisfiedLinkError: Native method not found: 本地方法没有找到

1、本地函数名写错

2、忘记加载.so文件 没有调用System.loadlibrary

错误2:findLibrary returned null

1、System.loadLibrary("libhello"); 加载动态链接库时 动态链接库名字写错

2、平台类型错误 把只支持arm平台的.so文件部署到了 x86cpu的设备上

查看帮助文档:

APP_ABI

By default, the NDK build system will generate machine code for the 'armeabi' ABI. This corresponds to an ARMv5TE based CPU with software floating point operations. You can use APP_ABI to select a different ABI.

For example, to support hardware FPU instructions on ARMv7 based devices, use:

     APP_ABI := armeabi-v7a

Or to support the IA-32 instruction set, use:

     APP_ABI := x86

Or to support the MIPS instruction set, use:

     APP_ABI := mips

Or to support all at the same time, use:

     APP_ABI := armeabi armeabi-v7a x86 mips

Or even better, since NDK r7, you can also use the special value 'all' which means "all ABIs supported by this NDK release":

     APP_ABI := all

For the list of all supported ABIs and details about their usage and limitations, please read CPU-ARCH-ABIS.

在jni目录下创建 Application.mk 在里面指定

APP_ABI := armeabi x86

重新编译后可以看到分成两个平台编译,生成2个.so文件

Android jni开发中的常见错误images/loading.gif' data-original="http://images2015.cnblogs.com/blog/617081/201607/617081-20160701161702952-128396098.png" />

我们可以看到上面的编译过程中出现警告,可以在 Application.mk 指定:
APP_PLATFORM := android-8

Android jni开发中的常见错误




原标题:Android jni开发中的常见错误

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

黑五挂号,网一“林丹”,背后真相竟是……:https://www.ikjzd.com/articles/111964
这个最新的亚马逊爆款产品,新手卖家要当心!:https://www.ikjzd.com/articles/111965
速卖通2020招商新政解读:商品搜索作弊处罚力度加大!:https://www.ikjzd.com/articles/111966
如何通过Amazon前后台获取关键词?:https://www.ikjzd.com/articles/111968
在Instagram上,如何更好地实现推广引流?:https://www.ikjzd.com/articles/111969
助力双12大促:Shopee推出广告金奖励计划!:https://www.ikjzd.com/articles/111970
83万单,Halara的TikTok美国小店爆单思路拆解:https://www.kjdsnews.com/a/1836319.html
83万单,Halara的TikTok美国小店爆单思路拆解:https://www.goluckyvip.com/news/186217.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流