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.
Failed to find GeneratedAppGlideModule error
According to the documentation from Glide on GitHub:
repositories {
mavenCentral()
google() // You were missing this
}
dependencies {
implementation 'com.github.bumptech.glide:glide:4.9.0' //bumped from 4.8.0 to 4.9.0
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}
Always make sure to use the latest version. It was being caused due to missing google()
repository in your project level gradle file.
Android Glide Cannot Resolve Method 'with' in GlideApp
According to the latest instructions you don't actually need to do ANY of the stuff from the link in the question. You just use "Glide" as normal and you don't have to use "GLideApp".
repositories {
google()
jcenter()
}
dependencies {
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
}
It also doesn't look like you need to setup a custom class or anything like that.
So I reverted to my old code:
Glide
.with(this)
.load(imageUrl)
.centerCrop()
.transition(withCrossFade())
.into(eventImageView);
}
How do i fix glide with keyword error in kotlin
check import package of glide library.
import the below two packages
1)import com.bumptech.glide.Glide
2)import com.bumptech.glide.request.RequestOptions
Related Topics
How to Change The Overscroll Color in Android 2.3.1
Your Project Path Contains Non-Ascii Characters Android Studio
How to Print a Double with Two Decimals in Android
Apply Two Different Font Styles to a Textview
Android Word-Wrap Edittext Text
Android Send a Image and Save Url
How to Run Android Studio (Android Sdk Emulator) in a Microsoft Hyper-V Virtual Machine
Android Material Design Inline Datepicker Issue
Evenly Spaced Menu Items on Toolbar
Specifying a Link Key in Android Without Pairing
Google Map for Android My Location Custom Button
How to Make Part of The Text Bold in Android at Runtime
Difference Between Getstring() and Getresources.Getstring()
Reasons That The Passed Intent Would Be Null in Onstartcommand
Actionlayout on Menuitem Does Nothing