Glide showing error: Failed to find GeneratedAppGlideModule

Finally, I found my answer here.

What I have done :

Step-1

I created an empty class named GlideApp

import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;

@GlideModule
public class GlideApp extends AppGlideModule {

}

Note: Don’t forget to add annotation @GlideModule.

Step-2
After that, I build/rebuild the project and then, replaced Glide with GlideApp.and now no need to use RequestOptions.

public class CustomBindingAdapter {

    @BindingAdapter({"bind:image_url"})
    public static void loadImage(ImageView imageView, String url) {

//        RequestOptions requestOptions = new RequestOptions();
//        requestOptions=requestOptions.placeholder(R.drawable.boy_32);

        GlideApp.with(imageView.getContext())
                .load(url)
                .placeholder(R.drawable.boy_32)
                .into(imageView);

//            Glide.with(imageView.getContext())
//                    .load(url)
//                    .apply(requestOptions)
//                    .into(imageView);
    }
}

Edit:
For androidx and Glide versin 4.9.0:

In my app’s gradle.build:

implementation ("com.github.bumptech.glide:glide:4.9.0") {
    exclude group: "com.android.support"
}
annotationProcessor 'androidx.annotation:annotation:1.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation ("com.github.bumptech.glide:glide:4.9.0@aar") {
    transitive = true
}

In my gradle.properties:

android.enableJetifier=true
android.useAndroidX=true

That’s all.

Leave a Comment