J D
J D

Reputation: 757

Failed to resolve: de.hdodenhof:circleimageview:2.1.0

Tried adding both maven repositories but can't seem to get this to resolve.
Couldn't find any info on stackoverflow and was wondering what is the standard way to resolve dependencies in Gradle

Root build.gradle

buildscript {
    repositories {
        mavenCentral()
//        maven { url "https://mvnrepository.com/artifact/de.hdodenhof/circleimageview" }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

Module build.gradle

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
//    compile files('libs/CircleImageView-master/gradle/wrapper/gradle-wrapper.jar')
    compile 'de.hdodenhof:circleimageview:2.1.0'
}

Failed to resolve: de.hdodenhof:circleimageview:2.1.0

Upvotes: 1

Views: 4628

Answers (2)

OneCricketeer
OneCricketeer

Reputation: 191864

I can download that dependency as written in the question. For reference, though, here is my project's build.gradle. I think you need the allprojects piece. I've had problems where dependencies wouldn't resolve without that.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        mavenLocal()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        mavenLocal()
    }
}

An additional note: If you were to compile the cloned repo, you do it something like this

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(":CircleImageView-master:circleimageview")

    ...
}

Where the settings.gradle would have

include ':app', ':CircleImageView-master:circleimageview'

Upvotes: 2

Flávio Faria
Flávio Faria

Reputation: 6605

Did you add the compile dependency to the right Gradle file? Make sure the compile 'de.hdodenhof:circleimageview:2.1.0' line is in the dependencies {} block and that such block is in the build.gradle file that is in your module folder, not in the root directory of your project.

If it doesn't help, try running ./gradlew clean --refresh-dependencies from the command line.

Upvotes: 0

Related Questions