Fresco: java.lang.UnsatisfiedLinkError couldn't find DSO to load: libimagepipeline.so

Created on 23 Mar 2018  ·  9Comments  ·  Source: facebook/fresco

Info:

  • Fresco version:1.8.1
  • Platform version: Vivo Android 5.1.1, CPU: arm64-v8a

couldn't find DSO to load: 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 art : dlopen("/data/data/xxx/lib-main/libimagepipeline.so", RTLD_LAZY) failed: dlopen failed: "/data/data/xxx/lib-main/libimagepipeline.so" is 64-bit instead of 32-bit
03-23 19:21:55.955 17814 17931 E SoLoader: Could not load: libimagepipeline.so

detail

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)

_parent_##1##_parent_

_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)

_parent_##4##_parent_

_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)

_parent_##2##_parent_

_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

Most helpful comment

fuck the react

All 9 comments

Yes, this seems to be a duplicate of #2049 (especially https://github.com/facebook/fresco/issues/2049#issuecomment-367235216). @jyh149129, I'm closing the issue here to focus the discussion there :)

Thanks @gengjiawen!

fuck the react

Where is the solution? I am facing issue in 1.13.0 version of Fresco dependency. Please help me out.

I think I found why this bug happened, because the cpu_abi of /data/data/yourpackage/lib and /data/data/yourpackage/lib-main is different.
And why is it different? because ExtractFromZipSoSource.ensureDsos() had a defect.
What defect? There was an assumption that Android OS think you were a 64-bit app when you had both 32-bit and 64-bit so libraries. But, the rule was broken on the OPPO R7sm (Android 5.1.1 ColorOS: V3.0_170510_beta).

I have fixed the bug on my OPPO by modifying code, I will make a pull request later, expecting to help your guys.

Awesome, thanks for investigating @artemisia!

@artemisia Wish to see your PR!This bug confuses me a lot...

Sorry, my english is bad.

Device: Mobile Device: OPPC R7sm (AndroLinkid 5.1.1)
Findings:
When exists armeabi-v7a nad arm64-v8a in apk, generally loaded arm64-v8a. But OPPO R7sm is loaded armeabi-v7a.

I check path data/app//lib/. Find is arm, is not arm64. Generally should be arm64

When init soloader, will unzip data/app//.apk. And copy *.so to data/data//lib-main.
This flow will check the device support abi(ZipUnpacker.ensureDsos() on ExtractFromZipSoSource.java),
and check data/app//lib/arm/
.so and */.so of apk file (ApkUnpacker.shouldExtract() on ApkSoSource.java).
The files is not same. will copy to data/data//lib-main.

The get supportedAbis is ["arm64-v8a", "armeabi-v7a", "armeabi"]. Confirm the *.so file sequentially.
But data/app//lib/ is arm on OPPC R7sm, so always copy arm64-v8a the os file to data/data//lib-main.

Lead to *.so is 64-bit instead of 32-bit issue.

My solution:

Modify SoLoader library. Add check data/app//lib/ is arm or arm64.

File:
ExtractFromZipSoSource.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());
    ...

fuck the react

Welcome Flutter

Was this page helpful?
0 / 5 - 0 ratings