Glide Version:4.4.0
Integration libraries:No
Device/Android Version: Google Pixel
Issue details / Repro steps / Use case background:
The activity has a textview & imageview & imageview is using glide to load image, when the activity launches, it'll crash.
Glide load line / GlideModule (if any) / list Adapter code (if any):GlideModule
GlideApp.with(imageView.getContext())
.load(url)
.placeholder(placeholder)
.error(error)
.into(imageView);
Stack trace / LogCat:
java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat'
at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:119)
You can either update the version of the support library you're using (let me know if there's a reason why you can't/don't want to) or you can exclude the transitive support library dependency from Glide using Gradle, see https://discuss.gradle.org/t/how-do-i-exclude-specific-transitive-dependencies-of-something-i-depend-on/17991
Same problem
Thanks for reply. I haven't updated the support library because there is conflict between databinding & appcompat-v7:27.0.2, so I downgrade to appcompat-v7:26.1.0, and find this issue.
Here is my comment for the workaround solution:
android {
...
dataBinding {
enabled = true
}
}
dependencies {
...
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
implementation 'com.android.databinding:adapters:1.3.3'
implementation 'com.android.databinding:library:1.3.3'
...
}
The same problem happened. The reason I use SDK 26, not 27, is that SDK 27 does not have source code and some emulator images yet. Just adding this library to the build.gradle caused weird issues, and then I found out that error message. 27.0.2 and 26.1.0 cannot be used together or something. I chose the simplest solution above: using glide 4.3.1. But I hope this would be fixed soon.
What about just:
dependencies {
implementation ("com.github.bumptech.glide:glide:4.4.0") {
exclude group: "com.android.support"
}
implementation "com.android.support:support-fragment:26.1.0"
...
}
You'll have to manually include the support-fragment dependency, but otherwise it should work. Glide doesn't typically use cutting edge support library methods.
Can confirm excluding the transitive dependency works:
dependencies {
def supportLibVersion = "26.1.0"
implementation "com.android.support:appcompat-v7:$supportLibVersion"
...
implementation('com.github.bumptech.glide:glide:4.4.0') {
exclude group: "com.android.support"
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
}
I don't want to upgrade at the moment because the sources aren't available. I could copy the -26 sources over in the SDK, but I don't want to force every developer who opens the project to do the same.
Does anyone have any objection to updating to API 27 now that the sources are released?
Thanks for this news, I have updated to API 27, how about closing this issue?
Nice, no objections here 馃憤
b/71699561 is an internal bug tracking improving the error messages when support library versions conflict, no promises on any changes though.
This work for me
compileSdkVersion 27
targetSdkVersion 26
implementation 'com.github.bumptech.glide:glide:4.5.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.5.0'
still conflict at 4.4.0 4.5.0
Same issue resolving back to 4.3.1 works fine. I hope this gets fixed.
This also seems to work.
implementation ("com.github.bumptech.glide:glide:4.6.1") {
exclude group: "com.android.support"
}
android:targetSdkVersion="21" />
Most helpful comment
What about just:
You'll have to manually include the support-fragment dependency, but otherwise it should work. Glide doesn't typically use cutting edge support library methods.