-
Notifications
You must be signed in to change notification settings - Fork 629
[AAB] Feature: Support AAB And extractNativeLibs=false #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
项目未配置 `useLegacyPackaging=true` 时, 使用AAB安装, 或最低版本为Android M以上的APK Native库不会从APK中解压, 参考: https://developer.android.com/guide/topics/manifest/application-element#extractNativeLibs google/bundletool#39 此时xCrash通过 `ctx.getApplicationInfo().nativeLibraryDir` 获取的目录内容是空的 因此会出现加载xcrash_dumper失败 而通过 PathClassloader.findLibrary(libName) 获取的路径是虚拟路径, 不是真实存在的 因此直接执行也会失败 此时我们参考 Crashpad 的逻辑, 使用linker加载 参考: https://github.com/chromium/crashpad/blob/main/client/crashpad_client_linux.cc#L114 为了避免大的改动, 默认仅在加载虚拟路径时使用linker, 实际上在所有场景都可以直接通过linker加载 支持外部自定义配置 ``` .setNativeLibPath() .setLoadNativeWithLinker() ``` 如果外部没有配置,内部会自动查找 参考: AbiPathProvider.java 逻辑
这个方案在android 9以下不行,大佬针对android 9及以下,采用的是什么方案。 |
我看下~ |
Android 9及以下不支持使用linker方式,所以将so从apk中解压出来,再通过普通方式启动 |
你也遇到了么, 我们再aab上Android 9及以下, 使用linker 也没问题呀。。。 |
前面你有同事找过我, 现在咋样了,解决了嘛, 是怎么解决的? |
感谢回复。 https://cs.android.com/android/platform/superproject/+/android-10.0.0_r1:bionic/linker/linker_main.cpp;l=659-677 |
我刚遇到此问题,和他并不认识哈。 |
项目未配置
useLegacyPackaging=true
时,使用AAB安装, 或最低版本为Android M以上的APK
Native库不会从APK中解压, 参考:
https://developer.android.com/guide/topics/manifest/application-element#extractNativeLibs google/bundletool#39
此时xCrash通过
ctx.getApplicationInfo().nativeLibraryDir
获取的目录内容是空的 因此会出现加载xcrash_dumper失败而通过 PathClassloader.findLibrary(libName) 获取的路径是虚拟路径, 不是真实存在的 因此直接执行也会失败
此时我们参考 Crashpad 的逻辑, 使用linker加载
参考:
https://github.com/chromium/crashpad/blob/main/client/crashpad_client_linux.cc#L114
为了避免大的改动, 默认仅在加载虚拟路径时使用linker, 实际上在所有场景都可以直接通过linker加载
支持外部自定义配置
如果外部没有配置,内部会自动查找
参考: AbiPathProvider.java 逻辑