Skip to content
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

java.lang.NoClassDefFoundError: com.bumptech.glide.load.resource.drawable.GlideDrawable #196

Open
liliangzdh opened this issue Apr 28, 2018 · 24 comments

Comments

@liliangzdh
Copy link

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) 

@liliangzdh
Copy link
Author

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

@liliangzdh
Copy link
Author

the Image Gidle Verion

@DylanVann
Copy link
Owner

DylanVann commented Apr 30, 2018

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: bumptech/glide#2962 (comment)

@WuPan1018
Copy link

Is there a solution?

@DylanVann
Copy link
Owner

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.

@jnrepo
Copy link

jnrepo commented May 7, 2018

@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?

@DylanVann
Copy link
Owner

@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: #201

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

Let me know what happens.

@jnrepo
Copy link

jnrepo commented May 7, 2018

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

@DylanVann
Copy link
Owner

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.

@jnrepo
Copy link

jnrepo commented May 7, 2018

@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.

@DylanVann
Copy link
Owner

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.

@jnrepo
Copy link

jnrepo commented May 7, 2018

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

@DylanVann
Copy link
Owner

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.

@DylanVann
Copy link
Owner

DylanVann commented May 10, 2018

Update on this: #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.

@wuyunqiang
Copy link

"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.

@jiasongs
Copy link

jiasongs commented Jun 4, 2018

+1

@DylanVann
Copy link
Owner

@wuyunqiang

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

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

@wsh794972562
Copy link

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

@wsh794972562
Copy link

you latest version on master still have this problem

@DylanVann
Copy link
Owner

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

@wsh794972562
Copy link

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

@wsh794972562
Copy link

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

@clytras
Copy link

clytras commented Aug 12, 2018

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'
  ...
}
@gpawlik
Copy link

gpawlik commented Sep 26, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
9 participants