libxxx.so- text relocations问题的终极解决方案

问题表现形式

错误或警告日志

当targetSdkVersion>=23且使用debug签名时,在6.0+的Android设备上运行App会输出以下错误Log:

E/linker: /data/app/packagename/lib/arm/libxxx.so: has text relocations
W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/packagename/lib/arm/libxxx.so: has text relocations

注意:当targetSdkVersion>=23,在低于6.0的设备上运行是正常的,至于原因,本文最后会谈到。

当targetSdkVersion<23且使用debug签名时,在6.0+的Android设备上虽然运行正常,但会输出以下警告Log:

W/linker: “/data/app/packagename/lib/arm/libxxx.so”: has W+E (writable and executable) load segments. This is a security risk shared libraries with W+E load segments will not be supported in a future Android release. Please fix the library.

W/linker: /data/app/packagename/lib/arm/libxxx.so has text relocations. This is wasting memory and prevents security hardening. Please fix.

App启动时弹出提醒对话框

当targetSdkVersion<23且使用debug签名的APK运行在高版本系统上(此处使用原生7.0测试),每次启动时会弹出一个对话框,其内容如下:

Detected problems with app native libraries (please consult log for detail) : libxxx.so: text relocations

上述各种表象可以发现是同一个问题所致,即libxxx.so: text relocations。

问题原因

“libxxx.so: text relocations”这个问题在Android 6.0官方的更新说明中有提及:

On previous versions of Android, if your app requested the system to load a shared library with text relocations, the system displaye

  • 13
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 16
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值