mohammad
mohammad

Reputation: 31

issue while adding glide dependencies

I wrote a program in android with java, when I add the Glide dependencies

implementation 'com.github.bumptech.glide:glide:4.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

my android studio begins to give me this error:

"ERROR: Failed to resolve: support-fragment Affected Modules: app

ERROR: Failed to resolve: animated-vector-drawable Affected Modules: app"

this is my app bulid.gradle with the error shown

I looked for any similar answer past week and try them all but I wasn't able to solve this problem, when I remove the Glide dependencies, everything comes back to normal again.

this is my app module build.gradle:

    apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.mohammad.kahgle"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}    
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.github.armcha:ElasticView:0.1.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.nightonke:boommenu:2.1.1'
implementation 'com.ramotion.foldingcell:folding-cell:1.2.2'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation "com.android.support:support-core-utils:28.0.0"
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Upvotes: 3

Views: 1523

Answers (6)

Mehran Mahmoudkhani
Mehran Mahmoudkhani

Reputation: 456

I got this problem. if you don't use animated vector drawable with glide use this code to exclude useless dependencies :

implementation ("com.github.bumptech.glide:glide:4.9.0"){
    exclude group: 'androidx.vectordrawable', module: 'vectordrawable-animated'
}

happy coding :)

Upvotes: 3

soheil azarvandi
soheil azarvandi

Reputation: 21

solving this problem in minsdkversion 21 and targetsdkversion 29 with below libraries:

add these to dependencies:

implementation 'androidx.fragment:fragment:1.2.0-rc04'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'

and downgrade the glide version to 4.8.0

implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'

Upvotes: 2

Omid Leilaj
Omid Leilaj

Reputation: 31

The solution is to delete the caches folder inside ~/.gradle and download the dependencies again.

Add:

 implementation 'androidx.fragment:fragment:1.2.0-alpha04' 
 implementation 'androidx.vectordrawable:vectordrawable:1.1.0' 
 implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0' 

to app/gradle

Upvotes: 0

Reza Khammary
Reza Khammary

Reputation: 191

use this :

 implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation group: 'androidx.fragment', name: 'fragment', version: '1.1.0'
implementation group: 'androidx.vectordrawable', name: 'vectordrawable-animated', version: '1.1.0'

Upvotes: 0

Jakir Hossain
Jakir Hossain

Reputation: 3930

Add this to your build.gradle file. for details see download section of Glide

repositories {
  mavenCentral()
  google()
}

Upvotes: 1

dardardardar
dardardardar

Reputation: 344

In your app module enable vectorDrawables useSupportLibrary

android {
    compileSdkVersion 27
    defaultConfig {
        ....
        vectorDrawables.useSupportLibrary = true
    }
}

Then add this in dependencies

dependencies {
    implementation 'com.android.support:support-vector-drawable:27.1.1'
}

Upvotes: 0

Related Questions