Fresco: java.lang.UnsatisfiedLinkError 找不到要加载的 DSO:libimagepipeline.so

创建于 2018-03-23  ·  9评论  ·  资料来源: facebook/fresco

信息:

  • 壁画版本:1.8.1
  • 平台版本:vivo Android 5.1.1,CPU:arm64-v8a

找不到要加载的 DSO:libimagepipeline.so
com.facebook.soloader.SoLoader.void doLoadLibraryBySoName(java.lang.String,int,android.os.StrictMode$ThreadPolicy)...
03-23 19:21:55.955 17814 17931 E 艺术:dlopen(“/data/data/xxx/lib-main/libimagepipeline.so”,RTLD_LAZY)失败:dlopen 失败:“/data/data/xxx/lib-main /libimagepipeline.so" 是 64 位而不是 32 位
03-23 19:21:55.955 17814 17931 E SoLoader:无法加载:libimagepipeline.so

细节

com.facebook.soloader.SoLoader.void doLoadLibraryBySoName(java.lang.String,int,android.os.StrictMode$ThreadPolicy)(SoLoader.java:522)
com.facebook.soloader.SoLoader.void loadLibraryBySoName(java.lang.String,java.lang.String,java.lang.String,int,android.os.StrictMode$ThreadPolicy)(SoLoader.java:420)
com.facebook.soloader.SoLoader.void loadLibrary(java.lang.String,int)(SoLoader.java:370)
com.facebook.soloader.SoLoader.void loadLibrary(java.lang.String)(SoLoader.java:335)
com.facebook.imagepipeline.nativecode.ImagePipelineNativeLoader.void load()(ImagePipelineNativeLoader.java:42)
com.facebook.imagepipeline.memory.NativeMemoryChunk.void()(NativeMemoryChunk.java:33)
com.facebook.imagepipeline.memory.NativeMemoryChunkPool.com.facebook.imagepipeline.memory.NativeMemoryChunk alloc(int)(NativeMemoryChunkPool.java:58)
com.facebook.imagepipeline.memory.NativeMemoryChunkPool.void free(java.lang.Object)(NativeMemoryChunkPool.java:20)

_父母_##1##_父母_

_child_## java.lang.Object alloc(int)##_child_

com.facebook.imagepipeline.memory.BasePool.java.lang.Object get(int)(BasePool.java:257)
com.facebook.imagepipeline.memory.NativePooledByteBufferOutputStream.void(com.facebook.imagepipeline.memory.NativeMemoryChunkPool,int)(NativePooledByteBufferOutputStream.java:51)
com.facebook.imagepipeline.memory.NativePooledByteBufferFactory.com.facebook.imagepipeline.memory.NativePooledByteBuffer newByteBuffer(java.io.InputStream,int)(NativePooledByteBufferFactory.java:98)
com.facebook.imagepipeline.memory.NativePooledByteBufferFactory.com.facebook.common.memory.PooledByteBufferOutputStream newOutputStream(int)(NativePooledByteBufferFactory.java:26)

_父母_##4##_父母_

_child_## com.facebook.common.memory.PooledByteBufferOutputStream newOutputStream()##_child_

_child_## com.facebook.common.memory.PooledByteBuffer newByteBuffer(java.io.InputStream,int)##_child_

_child_## com.facebook.common.memory.PooledByteBuffer newByteBuffer(byte[])##_child_

_child_## com.facebook.common.memory.PooledByteBuffer newByteBuffer(java.io.InputStream)##_child_

com.facebook.imagepipeline.producers.LocalFetchProducer.com.facebook.imagepipeline.image.EncodedImage getByteBufferBackedEncodedImage(java.io.InputStream,int)(LocalFetchProducer.java:89)

_父母_##2##_父母_

_child_## com.facebook.imagepipeline.image.EncodedImage getEncodedImage(com.facebook.imagepipeline.request.ImageRequest)##_child_

_child_## java.lang.String getProducerName()##_child_

com.facebook.imagepipeline.producers.LocalFetchProducer.com.facebook.imagepipeline.image.EncodedImage getEncodedImage(java.io.InputStream,int)(LocalFetchProducer.java:101)
com.facebook.imagepipeline.producers.LocalFileFetchProducer.com.facebook.imagepipeline.image.EncodedImage getEncodedImage(com.facebook.imagepipeline.request.ImageRequest)(LocalFileFetchProducer.java:34)
com.facebook.imagepipeline.producers.LocalFetchProducer$1.com.facebook.imagepipeline.image.EncodedImage getResult()(LocalFetchProducer.java:54)
com.facebook.imagepipeline.producers.LocalFetchProducer$1.java.lang.Object getResult()(LocalFetchProducer.java:50)
com.facebook.common.executors.StatefulRunnable.void run()(StatefulRunnable.java:45)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
com.facebook.imagepipeline.core.PriorityThreadFactory$1.void run()(PriorityThreadFactory.java:53)
java.lang.Thread.run(Thread.java:818)

duplicate

最有用的评论

他妈的反应

所有9条评论

是的,这似乎是 #2049 的副本(尤其是 https://github.com/facebook/fresco/issues/2049#issuecomment-367235216)。 @jyh149129 ,我在这里结束这个问题以集中讨论:)

谢谢@gengjiawen!

他妈的反应

解决方案在哪里? 我在 1.13.0 版本的 Fresco 依赖项中遇到问题。 请帮帮我。

我想我找到了这个错误发生的原因,因为 /data/data/yourpackage/lib 和 /data/data/yourpackage/lib-main 的 cpu_abi 是不同的。
为什么不一样? 因为 ExtractFromZipSoSource.ensureDsos() 有缺陷。
什么缺陷? 有一种假设是,当您同时拥有 32 位和 64 位 so 库时,Android 操作系统认为您是一个 64 位应用程序。 但是,规则在 OPPO R7sm(Android 5.1.1 ColorOS:V3.0_170510_beta)上被打破。

我已经通过修改代码修复了我的OPPO上的bug,稍后我会提出一个pull request,希望能帮助到你们。

太棒了,感谢您调查@artemisia!

@artemisia希望看到你的PR!这个bug让我很困惑......

对不起,我的英语不好。

设备:移动设备:OPPC R7sm (AndroLinkid 5.1.1)
发现:
当apk中存在armeabi-v7a nad arm64-v8a时,一般加载arm64-v8a。 但是OPPO R7sm装的是armeabi-v7a。

我检查路径数据/应用程序//库/。 find 是 arm,不是 arm64。 一般应该是arm64

init soloader 时,会解压 data/app//.apk。 /lib 主。此流程将检查设备支持 abi(ZipUnpacker.ensureDsos() on ExtractFromZipSoSource.java),并检查数据/应用程序//lib/手臂/ apk 文件的 .so 和 */.so(ApkSoSource.java 上的 ApkUnpacker.shouldExtract())。
文件不一样。 将复制到数据/数据//lib 主。

获得支持的 Abis 是 ["arm64-v8a", "armeabi-v7a", "armeabi"]。 依次确认 *.so 文件。
但是 data/app//lib/ 是 OPPC R7sm 上的 arm,所以总是将 arm64-v8a 的 os 文件复制到 data/data//lib 主。

导致 *.so 是 64 位而不是 32 位问题。

我的解决方案:

修改 SoLoader 库。 添加检查数据/应用程序//lib/ 是 arm 或 arm64。

文件:
提取自ZipSoSource.java

    ...
    final ZipDso[] ensureDsos() {
      if (mDsos == null) {
        Set<String> librariesAbiSet = new LinkedHashSet<>();
        HashMap<String, ZipDso> providedLibraries = new HashMap<>();
        Pattern zipSearchPattern = Pattern.compile(mZipSearchPattern);
        String[] supportedAbis = SysUtil.getSupportedAbis();
        Enumeration<? extends ZipEntry> entries = mZipFile.entries();

+        // Fixed couldn't find DSO to load:  "xxx.os"  is 64-bit instead of 32-bit
+       File sysLibPath =  new File(mContext.getApplicationInfo().nativeLibraryDir);
+       String sysLibAbi = sysLibPath.getPath().substring(sysLibPath.getPath().lastIndexOf("/")+1);
+       if(sysLibAbi.equalsIgnoreCase("arm")) {
+         // sys lib is load armeabi-v7a, this exception case
+         ArrayList<String> newSupportedAbis = new ArrayList();
+         for(String abi : supportedAbis) {
+           if(abi.equalsIgnoreCase("arm64-v8a")) {
+               //skip arm64-v8a
+               continue;
+           }
+
+           newSupportedAbis.add(abi);
+         }
+
+         supportedAbis = newSupportedAbis.toArray(new String[newSupportedAbis.size()]);
+       }


        while (entries.hasMoreElements()) {
          ZipEntry entry = entries.nextElement();
          Matcher m = zipSearchPattern.matcher(entry.getName());
    ...

他妈的反应

欢迎颤振

此页面是否有帮助?
0 / 5 - 0 等级