Fresco: NoClassDefFoundError SoLoaderShim$Handler

Created on 16 Feb 2018  路  9Comments  路  Source: facebook/fresco

Description

NoClassDefFoundError when update the fresco lib v 1.8.1 with the react SoLoaderShim$Handler

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/common/soloader/SoLoaderShim$Handler;
at com.facebook.react.shell.MainReactPackage$8.get(MainReactPackage.java:149)
at com.facebook.react.shell.MainReactPackage$8.get(MainReactPackage.java:146)
at com.facebook.react.LazyReactPackage.createNativeModules(LazyReactPackage.java:81)
at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:106)
at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1071)
at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1042)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:980)
at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109)
at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:802)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.common.soloader.SoLoaderShim$Handler" on path: DexPathList[[zip file
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.facebook.react.shell.MainReactPackage$8.get(MainReactPackage.java:149)
at com.facebook.react.shell.MainReactPackage$8.get(MainReactPackage.java:146)
at com.facebook.react.LazyReactPackage.createNativeModules(LazyReactPackage.java:81)
at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:106)
at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1071)
at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1042)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:980)
at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109)
at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:802)
at java.lang.Thread.run(Thread.java:761)

gradle dependencies

frescoLibVersion = '1.5.0'
okHttp3 = '1.5.0'

compile("com.facebook.fresco:fresco:$frescoLibVersion") {
    exclude module: 'bolts-tasks'
}
compile("com.facebook.fresco:animated-gif:$frescoLibVersion") {
    exclude module: 'bolts-tasks'
}

compile('com.facebook.react:react-native:+') {
    exclude module: 'bolts-tasks'
}
compile("com.facebook.fresco:imagepipeline-okhttp3:$okHttp3") {
    exclude module: 'bolts-tasks'
}
compile ('com.facebook.shimmer:shimmer:0.1.0@aar')

Additional Information

  • Fresco version: 1.8.1
  • Platform version: android API v26
bug

Most helpful comment

Looks like RN 0.54 will fix your issue after this commit.
https://github.com/facebook/react-native/commit/fc6dd78935a41106aa6a44058c1abb7d0ba0fa24

All 9 comments

same issue here.
So I am finding another way to display GIF image.

Hi @Anilugale and @lin-zy1229, thank you very much for raising the issue. This might be due to our updates regarding the compile/api directives in 1.8.0. We'll look into reproducing this locally such that I can precisely see what's going wrong here.

This problem also been mentioned in https://github.com/facebook/fresco/issues/2055 (which I'll close so we have this issue as the single place for communication). Also CC @dmitryou from the other issue.

When you figure out something in the mean time, please let me know.

@Anilugale in your issue, you specify:

Fresco version: 1.8.1

But also:

frescoLibVersion = '1.5.0'

Which one is true?

Also, what is your React Native version?

@foghina
when i use the lib v 1.5.0 it working fine but but when i update it from 1.5.0 to 1.8.1 then get this issue.

yes. also 1.7.1 doesn't work.
it is working perfectly as follows: (for RN 0.51.0)

    compile 'com.facebook.fresco:fresco:1.3.0'
    compile 'com.facebook.fresco:animated-gif:1.3.0'

Well, React Native depends on Fresco 1.3.0, see here:

https://github.com/facebook/react-native/blob/master/ReactAndroid/build.gradle#L284

So if you're overriding the Fresco version you can expect things not to work. I'm checking internally to see if / how we can fix this.

Thanks for looking into this It would be great to get an update on how this should work, there seems to be no clear answer in either the Fresco or the React Native docs/issues yet. We'd love a solution that is clearly documented.

(Currently our project is on 0.51.0, for whatever it is worth.)

Looks like RN 0.54 will fix your issue after this commit.
https://github.com/facebook/react-native/commit/fc6dd78935a41106aa6a44058c1abb7d0ba0fa24

I'm closing the issue since this should work with newer RN versions as suggested by @AndrewJack

Was this page helpful?
0 / 5 - 0 ratings