Glide: Cannot build with Android Studio 3.1 Gradle 4.4: "Failed to resolve: glide 3rd-party Gradle plug-ins may be the cause"

Created on 28 Mar 2018  路  20Comments  路  Source: bumptech/glide


4.6.1


Integration libraries:
okhttp3


Stack trace / gradle console:

Failed to resolve: glide
Open File

Folder G:\..\app\build\generated\source\kaptKotlin\debug
Folder G:\..\app\build\generated\source\kaptKotlin\release

3rd-party Gradle plug-ins may be the cause

app/build.gradle

    implementation 'com.github.bumptech.glide:glide:4.6.1'
    kapt 'com.github.bumptech.glide:compiler:4.6.1'

Reordering repositories like goffity mentions below did not work for me.

question

Most helpful comment

Update It's solved.
I re-order repositories from
repositories {
google()
jcenter()
mavenCentral()
}

To

repositories {
mavenCentral()
google()
jcenter()
}

All 20 comments

I have same problem.

I got error message.

Could not find glide.jar (com.github.bumptech.glide:glide:4.6.1).
Searched in the following locations:
https://jcenter.bintray.com/com/github/bumptech/glide/glide/4.6.1/glide-4.6.1.jar

My build.gradle

buildscript { repositories { google() jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:3.1.0' } } allprojects { repositories { google() jcenter() mavenCentral() } }

dependencies { implementation 'com.github.bumptech.glide:glide:4.6.1' annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1' }

I got the same thing, I was able to build by reverting to version 4.5.0
Version 4.6.0 would sync but when I go to build the Glide Module would cause the build to break.

Update It's solved.
I re-order repositories from
repositories {
google()
jcenter()
mavenCentral()
}

To

repositories {
mavenCentral()
google()
jcenter()
}

4.5.0 did work.

delete gradle cache folder( ~/.gradle/caches).

In my case I can build the project, but I got this message:
3rd-party Gradle plug-ins may be the cause .
I re-ordered to:
mavenCentral()
maven { url 'https://jitpack.io' }
google()
jcenter()

And It's working now.

I solved it adding the next things:

Platform modules targeting Android
The update of the experimental multiplatform projects feature introduces support for Android platform modules. These modules should apply the corresponding plugin in the Gradle build script and can use the shared code from a common module:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-platform-android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
// ...

Kapt diagnostic locations
As of now, kapt, the Kotlin annotation processing tool, can offer links to locations in the original Kotlin code rather than generated Java stubs as it reports errors encountered during annotation processing. You can enable this feature by adding these lines to the Gradle build script (build.gradle):

kapt {
    mapDiagnosticLocations = true
}

IntelliJ IDEA plugin improvements
Kotlin 1.2.30 brings various improvements in the IntelliJ IDEA Kotlin plugin, including performance improvements, bug fixes, and new inspections and intentions.

Kinf of optional for some projects:

    repositories {
        mavenCentral()
        jcenter()
        google()
    }

Add all of this, Clean your project, build and That's it! :) Let me know if this works! (If it is not working for you, I will help you with another solution)

I believe the real solution is clearing gradle caches as suggested by b1uec0in. After building with 4.5.0 then building again with 4.6.1 it succeeded. Unfortunately, I can't confirm this fix. If someone else can then I am comfortable closing this ticket. Thanks for all the input.

Huh, I haven't seen this. If clearing the gradle caches is confirmed, I can put something up on the docs page: http://bumptech.github.io/glide/doc/download-setup.html.

Do we know what changed outside of Glide that caused this?

Hey sjudd, this happened after upgrading Android Studio for Windows to 3.1, build tools to 27.0.3, and gradle to 4.4

As b1uec0in mentioned.
Clearing user's ~/.gradle/caches folder and deleting app build folder manually, followed by clean and rebuild worked for me.

Like @vinraodeloitte As b1uec0in mentioned. (Windows confirmation)
Clearing user's ~/.gradle/caches folder and deleting app build folder manually, followed by clean and rebuild worked for me.
If i need to do that on all of my projects, it's gonna take a while...

Great, I think it is safe to close.

(Apologies as I have edited this post many times)

I noticed that if I cleared the .gradle/cache, and also invalidated my project cache, I could get my app to compile with Glide 4.6.1. Just cleaning the build did not work. However, something happened with 4.6.1 where my external libraries (bottom of the project side bar) were not complete, so there were ide warnings everywhere of bad imports and the production release wasn't working. I reverted back to 4.5.0 and everything seems to be working fine (I needed to clean build as I got the kaptKotlin error). Future updates will go to #3006

@crismaver1993 it worked for me!
but why?

I think the crux of this is we need to put mavenCentral higher in the list than jcenter:

repositories {
    google()
    mavenCentral()
    jcenter()
}

This is the only thing that worked for me. Likely related to https://github.com/bumptech/glide/issues/544?

Clearing gradle cache, invalidating AS cache and rebuilding worked for me.

Change Kotlin version up to 1.2.61, it's gone.

Guys If you have build the project with kotlin support. So, in your gradle file you will find
apply plugin: 'kotlin-kapt' so then GlideApp will be generated with below dependencies. replace annotateProcessor with kapt

implementation 'com.github.bumptech.glide:glide:4.8.0' kapt 'com.github.bumptech.glide:compiler:4.8.0'

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tryking picture Tryking  路  3Comments

technoir42 picture technoir42  路  3Comments

kenneth2008 picture kenneth2008  路  3Comments

billy2271 picture billy2271  路  3Comments

AndroidJohnsonWang picture AndroidJohnsonWang  路  3Comments