-
前言
这几天维护新公司的项目, 拿到项目看了一眼.心中千万个草泥马奔腾....这尼玛我那时候还在高考呢.. 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) call returns. To learn more abo