lib/arm/libVoAACEncoder.so has text relocations问题的解决方案

本文介绍了Android项目中遇到的lib/arm/libVoAACEncoder.so has text relocations问题,分析了原因并提供了三种解决方案:降低targetSdkVersion、遵循谷歌的文本重定位指南和重新编译so源文件。重点推荐了在Android.mk中添加-fPIC选项来编译出无text relocations问题的so文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  • 前言

这几天维护新公司的项目, 拿到项目看了一眼.心中千万个草泥马奔腾....这尼玛我那时候还在高考呢.. targetSdkVersion还是停留在19.既然来上班了.心里放心那些纠结,开始改吧.(心里很不请愿,但是为了生活我就忍下来..)首先进行6.0的权限适配,没有任何难度的完成..  7.0的文件共享,也没有问题.升级项目中用到的jar包(旧项目开发环境是eclipse)  那么重点来了部分jar在Android Studio中不存在.存在错误提示,如下:

File error accessing recents directory (directory doesn't exist?).
/lib/arm/libVoAACEncoder.so" has text relocations 
(https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#Text-Relocations-Enforced-for-API-level-23)

注意:当targetSdkVersion>=23,在低于6.0的设备上运行是正常的 ,编译运行到os库的时候程序会莫名地闪退. '

'总结:上述各种表象可以发现是同一个问题所致,即lib/arm/libVoAACEncoder.so" has text relocations .

  • 问题原因

lib/arm/libVoAACEncoder.so" has 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 displayed a warning but still allowed the library to be 
loaded. Beginning in this release, the system rejects this library if your app’s target SDK 
version is 23 or higher. To help you detect if a library failed to load, your app should 
log the dlopen(3) failure, and include the problem description text that 
the dlerror(3)&nb
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值