Skip to content
This repository has been archived by the owner on Jul 25, 2021. It is now read-only.

3.0.4 Crash from my app's Glide #77

Open
bugbunney opened this issue Oct 21, 2019 · 2 comments
Open

3.0.4 Crash from my app's Glide #77

bugbunney opened this issue Oct 21, 2019 · 2 comments

Comments

@bugbunney
Copy link

I get crash message :
java.lang.ClassCastException: com.github.irshulx.GlideRequests cannot be cast to com.my.app.GlideRequests at com.funliday.app.core.GlideApp.with(GlideApp.java:88)

And get some information:

Avoid AppGlideModule in libraries

Libraries must not include AppGlideModule implementations. Doing so will prevent any applications that depend on the library from managing their dependencies or configuring options like Glide’s cache sizes and locations.

In addition, if two libraries include AppGlideModules, applications will be unable to compile if they depend on both and will be forced to pick one or other other.

This does mean that libraries won’t be able to use Glide’s generated API, but loads with the standard RequestBuilder and RequestOptions will still work just fine (see the options page for examples).

from
http://bumptech.github.io/glide/doc/configuration.html#avoid-appglidemodule-in-libraries

And I found

Libraries

Libraries that do not register custom components do not need to perform any configuration steps and can skip the sections on this page entirely.

Libraries that do need to register a custom component, like a ModelLoader, can do the following:

Add one or more LibraryGlideModule implementations that register the new components.
Add the @GlideModule annotation to every LibraryGlideModule implementation
Add a dependency on Glide’s annotation processor.
An example LibraryGlideModule from Glide’s OkHttp integration library looks like this:

@GlideModule
public final class OkHttpLibraryGlideModule extends LibraryGlideModule {
  @Override
  public void registerComponents(Context context, Glide glide, Registry registry) {
    registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
  }
}
Using the @GlideModule annotation requires a dependency on Glide’s annotations:

compile 'com.github.bumptech.glide:annotations:4.9.0'

from 
http://bumptech.github.io/glide/doc/configuration.html#libraries

Dear irshuLx
Can you help me?

@shidiqbagoes
Copy link

I had the same problem

@KotlinWay
Copy link

There's never been a solution to this problem?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants