Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The 4.4.0 version is conflict with appcompat-v7:26.1.0 #2730

Closed
rivendell1984 opened this issue Dec 17, 2017 · 15 comments · Fixed by #2755
Closed

The 4.4.0 version is conflict with appcompat-v7:26.1.0 #2730

rivendell1984 opened this issue Dec 17, 2017 · 15 comments · Fixed by #2755
Labels

Comments

@rivendell1984
Copy link

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)
@sjudd
Copy link
Collaborator

sjudd commented Dec 18, 2017

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

@mvl-lehoai
Copy link

Same problem

@rivendell1984
Copy link
Author

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.

@rivendell1984
Copy link
Author

rivendell1984 commented Dec 18, 2017

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'
    ...
}

@HubKing
Copy link

HubKing commented Dec 18, 2017

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.

@sjudd
Copy link
Collaborator

sjudd commented Dec 18, 2017

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.

@xbao
Copy link

xbao commented Dec 20, 2017

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.

sjudd added a commit to sjudd/glide that referenced this issue Dec 21, 2017
Makes bumptech#2730 less likely. We can wait until the source is released before
updating to 27 again.
sjudd added a commit to sjudd/glide that referenced this issue Dec 22, 2017
Makes bumptech#2730 less likely. We can wait until the source is released before
updating to 27 again.
@sjudd
Copy link
Collaborator

sjudd commented Dec 23, 2017

Does anyone have any objection to updating to API 27 now that the sources are released?

@rivendell1984
Copy link
Author

rivendell1984 commented Dec 23, 2017

Thanks for this news, I have updated to API 27, how about closing this issue?

@xbao
Copy link

xbao commented Dec 25, 2017

Nice, no objections here 👍

@sjudd
Copy link
Collaborator

sjudd commented Jan 8, 2018

b/71699561 is an internal bug tracking improving the error messages when support library versions conflict, no promises on any changes though.

@NunciosChums
Copy link

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'

@JSpiner
Copy link

JSpiner commented Jan 24, 2018

still conflict at 4.4.0 4.5.0

@mikemike396
Copy link

mikemike396 commented Feb 7, 2018

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"
    }

@Gymkhana-Studio
Copy link

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

Successfully merging a pull request may close this issue.

9 participants