Glide: The 4.4.0 version is conflict with appcompat-v7:26.1.0

Created on 17 Dec 2017  路  15Comments  路  Source: bumptech/glide


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)
question

Most helpful comment

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.

All 15 comments

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:

  1. Just use appcompat-v7:27.0.2 & glide:4.4.0
  2. use databinding & appcompat-v7:26.1.0 & glide:4.3.1
  3. use databinding & appcompat-v7:27.0.2 & glide:4.4.0, we need set databinding's version to 1.3.3 like below, and it'll work well:
 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:minSdkVersion="19"
android:targetSdkVersion="21" />

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StefMa picture StefMa  路  3Comments

ersen-osman picture ersen-osman  路  3Comments

kooeasy picture kooeasy  路  3Comments

Tryking picture Tryking  路  3Comments

MrFuFuFu picture MrFuFuFu  路  3Comments