Abbas Jafari
Abbas Jafari

Reputation: 1643

Add library in android studio?

when I want to add this library:

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

My android take this error:

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.bumptech.glide:glide:4.9.0.

and this is my app module

apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.example.mahdi.chatapp"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.firebase:firebase-config:16.3.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'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-database:16.0.6'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
}

apply plugin: 'com.google.gms.google-services'

Upvotes: 1

Views: 1088

Answers (3)

Kunj Mehta
Kunj Mehta

Reputation: 411

You have not added the annotationProcessor

repositories {
mavenCentral()
maven { url 'https://maven.google.com' }
}

dependencies {
compile 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}

This is the code for downloading glide given in the Glide documentation. See this link: http://bumptech.github.io/glide/doc/download-setup.html#gradle

Upvotes: 1

Dinesh Sarma
Dinesh Sarma

Reputation: 521

to use latest version of glide i.e. above version 4, you have to add one extra dependency(glide compiler)

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

and in repositories you have to add

repositories {
  mavenCentral()
  google()
}

reference: https://github.com/bumptech/glide

Upvotes: 1

Akash Suresh Dandwate
Akash Suresh Dandwate

Reputation: 165

Have you added this code in Gradle file

repositories {
  mavenCentral()
  google()
}

Upvotes: 1

Related Questions