React-native-fast-image: java.lang.NoClassDefFoundError: com.bumptech.glide.load.resource.drawable.GlideDrawable

Created on 28 Apr 2018  Â·  24Comments  Â·  Source: DylanVann/react-native-fast-image

67dc7f0a58b142973aeaf9618b7576b8
b002e19eebade75d446ab5ff78cf6619

java.lang.NoClassDefFoundError: com.bumptech.glide.load.resource.drawable.GlideDrawable
at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
at java.lang.Class.getDexCacheType(Class.java:2551)
at java.lang.reflect.AbstractMethod.getParameterTypes(AbstractMethod.java:169)
at java.lang.reflect.Method.getParameterTypes(Method.java:193)
at java.lang.Class.getDeclaredMethods(Class.java:1812)
at com.facebook.react.uimanager.ViewManagersPropertyCache.extractPropSettersFromViewManagerClassDefinition(ViewManagersPropertyCache.java:426)
at com.facebook.react.uimanager.ViewManagersPropertyCache.getNativePropSettersForViewManagerClass(ViewManagersPropertyCache.java:320)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.(ViewManagerPropertyUpdater.java:122)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.(ViewManagerPropertyUpdater.java:116)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.findManagerSetter(ViewManagerPropertyUpdater.java:79)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.getNativeProps(ViewManagerPropertyUpdater.java:66)
at com.facebook.react.uimanager.ViewManager.getNativeProps(ViewManager.java:205)
at com.facebook.react.uimanager.UIManagerModuleConstantsHelper.createConstantsForViewManager(UIManagerModuleConstantsHelper.java:147)
at com.facebook.react.uimanager.UIManagerModuleConstantsHelper.createConstants(UIManagerModuleConstantsHelper.java:94)
at com.facebook.react.uimanager.UIManagerModule.createConstants(UIManagerModule.java:224)
at com.facebook.react.uimanager.UIManagerModule.(UIManagerModule.java:148)
at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:175)
at com.facebook.react.CoreModulesPackage.access$200(CoreModulesPackage.java:55)
at com.facebook.react.CoreModulesPackage$7.get(CoreModulesPackage.java:132)
at com.facebook.react.CoreModulesPackage$7.get(CoreModulesPackage.java:129)
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:1171)
at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1141)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1083)
at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:113)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:920)
at java.lang.Thread.run(Thread.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.bumptech.glide.load.resource.drawable.GlideDrawable" on path: DexPathList[[zip file "/data/app/aolei.ydniu-1/base.apk"],nativeLibraryDirectories=[/data/app/aolei.ydniu-1/lib/arm, /data/app/aolei.ydniu-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/vendor/lib, /product/lib]]
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 libcore.reflect.InternalNames.getClass(InternalNames.java:53)
at java.lang.Class.getDexCacheType(Class.java:2551) 
at java.lang.reflect.AbstractMethod.getParameterTypes(AbstractMethod.java:169) 
at java.lang.reflect.Method.getParameterTypes(Method.java:193) 
at java.lang.Class.getDeclaredMethods(Class.java:1812) 
at com.facebook.react.uimanager.ViewManagersPropertyCache.extractPropSettersFromViewManagerClassDefinition(ViewManagersPropertyCache.java:426) 
at com.facebook.react.uimanager.ViewManagersPropertyCache.getNativePropSettersForViewManagerClass(ViewManagersPropertyCache.java:320) 
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.(ViewManagerPropertyUpdater.java:122) 
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.(ViewManagerPropertyUpdater.java:116) 
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.findManagerSetter(ViewManagerPropertyUpdater.java:79) 
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.getNativeProps(ViewManagerPropertyUpdater.java:66) 
at com.facebook.react.uimanager.ViewManager.getNativeProps(ViewManager.java:205) 
at com.facebook.react.uimanager.UIManagerModuleConstantsHelper.createConstantsForViewManager(UIManagerModuleConstantsHelper.java:147) 
at com.facebook.react.uimanager.UIManagerModuleConstantsHelper.createConstants(UIManagerModuleConstantsHelper.java:94) 
at com.facebook.react.uimanager.UIManagerModule.createConstants(UIManagerModule.java:224) 
at com.facebook.react.uimanager.UIManagerModule.(UIManagerModule.java:148) 
at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:175) 
at com.facebook.react.CoreModulesPackage.access$200(CoreModulesPackage.java:55) 
at com.facebook.react.CoreModulesPackage$7.get(CoreModulesPackage.java:132) 
at com.facebook.react.CoreModulesPackage$7.get(CoreModulesPackage.java:129) 
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:1171) 
at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1141) 
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1083) 
at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:113) 
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:920) 
at java.lang.Thread.run(Thread.java:776) 

Most helpful comment

Well hopefully I can resolve that issue and get around to publishing it soon. For now you should be able to just point to the branch. Glad you've found a way to resolve this.

All 24 comments

the glide Version is 3.8.0。 but another component need glide Version is 4.5.0。can you update the glide Version ?

the Image Gidle Verion

I was working on updating the glide version but I've hit an issue with it and haven't had time to figure it out yet. See: https://github.com/bumptech/glide/issues/2962#issuecomment-375961735

Is there a solution?

There isn't a solution yet. I don't know how to resolve that issue and haven't had time to take another look yet.

@DylanVann Wanted to start off by saying great repo! This works well for me on iOS, but starting my Android app will immediately throw this error. Would you happen to know any temporary workaround?

@jnrepo If you're using Glide elsewhere in your app I'm not sure what will happen with this since Glide says to only use a single AppGlideModule, but you could try using the branch feat/glide-4, which is for this PR: https://github.com/DylanVann/react-native-fast-image/pull/201

yarn add github:DylanVann/react-native-fast-image#feat/glide-4

Let me know what happens.

@DylanVann thanks for that quick response, will keep you updated

On that branch I've just pushed a commit that will allow you to make this library depend on a specific glide version by using extra properties. Just add this to android/build.gradle:

project.ext {
    glideVersion = "4.6.1"
}

In this case theoretically any 4.x.x version should work.

@DylanVann thanks! I was actually able to fix my issue. I found the other module that was using glide and excluded that version

    implementation(project(':react-native-smooch')) {
      exclude group: 'com.github.bumptech.glide', module: 'glide'
    }

and that seemed to fix my issue.

As with the feat/glide-4 branch I tested it, but ran into this error:

Note: [2] Wrote GeneratedAppGlideModule with: [com.bumptech.glide.integration.okhttp3.OkHttpLibraryGlideModule, com.dylanvann.fastimage.FastImageOkHttpProgressGlideModule]
/Users/user/project/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageOkHttpProgressGlideModule.java:39: error: cannot find symbol
    public void applyOptions(Context context, GlideBuilder builder) {builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888); }
                                              ^
  symbol:   class GlideBuilder
  location: class FastImageOkHttpProgressGlideModule
1 error

UPDATE: above error can also be fixed by omitting glide from my other module.

I tried it out myself and noticed that error. I pushed a commit that fixes it.

I'd be concerned that using that solution might break in some cases if react-native-smooch is expecting Glide 4 to be available.

@DylanVann cool, thank you so much! Tested the new version (feat/glide-4) and works great

Well hopefully I can resolve that issue and get around to publishing it soon. For now you should be able to just point to the branch. Glad you've found a way to resolve this.

Update on this: https://github.com/DylanVann/react-native-fast-image/pull/201

Sort of an unfortunate situation with Glide@4 and I'm not sure what the best solution is yet. Still thinking...

edit: Figured out a decent solution, merged that PR into master. Will do a beta release with Glide 4 soon.

"react-native-fast-image": "^4.0.14"
yarn add react-native-fast-image
react native link
and bug still here.

open react-native-fast-image android/build.gradle
glide 3.8 still

git clone https://github.com/DylanVann/react-native-fast-image.git
copy react-native-fast-image/android to myproject/node_module/react-native-fast-image/android will be ok.

+1

@wuyunqiang

yarn add github:DylanVann/react-native-fast-image

This will use the latest version on master, which includes upgrading glide.

why you delete#201,then how can I resolve problem

you latest version on master still have this problem

it's merged into master. the latest version on master uses Glide 4

With your approach, iOS doesn't work, and you're missing the sdwebimag-related header files

Even though I introduced sdwebimage myself, I still couldn't find the FLAnimatedImageView

When trying to use yarn add github:DylanVann/react-native-fast-image I get a yarn error:

error Error parsing JSON at "https://raw.githubusercontent.com/DylanVann/react-native-fast-image/05830ad8a70f243dc4a6e089714866070f48f58a/package.json", "Unexpected token : in JSON at position 3".

I guess I have to add glide dependencies manually for now.

EDIT:

I tried to add it again after I added it by default and it worked. I still have to include glide and glide:okhttp3 but it works now:

dependencies {
  implementation(project(':react-native-fast-image')) {
    transitive = false
  }
  annotationProcessor "com.github.bumptech.glide:compiler:4.7.1"
  implementation("com.github.bumptech.glide:okhttp3-integration:4.7.1") {
    exclude group: "com.android.support"
    exclude group: 'glide-parent'
  }

  implementation 'com.github.bumptech.glide:glide:4.7.1'
  ...
}

I had the same problem after upgrading to 7.0.2 which I solved after updating dependency lock file: cd android && ./gradlew generateLock saveLock. Apparently com.github.bumptech.glide version was locked there and needed to be updated.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aligertor picture Aligertor  Â·  3Comments

clay-morgan picture clay-morgan  Â·  3Comments

skleest picture skleest  Â·  3Comments

NgocNamFNT picture NgocNamFNT  Â·  3Comments

kmilodenisglez picture kmilodenisglez  Â·  3Comments