Jay
Jay

Reputation: 5084

Android Studio Error: Failed to Resolve.. <Library name>

I am trying to implement the gradle:

compile 'com.edmodo:cropper:1.0.2'

..in my project and I keep getting an error when the Gradle is building. The error I get is:

Error:(36, 13) Failed to resolve: com.edmodo:cropper:1.0.2

That's all it displays and it doesn't even display a reason. I referred to THIS answer as well, but the error persists. Why does this error normally occur?

EDIT:

My build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

EDIT:

App module

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.myapp.testapp"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.code.gson:gson:2.3'
    compile 'com.google.guava:guava:18.0'
    compile 'com.googlecode.android-query:android-query:0.25.9'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
    compile 'com.edmodo:cropper:1.0.2'
}

Upvotes: 3

Views: 2831

Answers (2)

suku
suku

Reputation: 10937

With Gradle 2.2.2, add following into projectname.gradle file:

allprojects {
repositories {
    jcenter()
    maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
    maven { url "https://jitpack.io" }
}
}

Upvotes: 0

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

You can use compile 'com.edmodo:cropper:1.0.1'

build.gradle

    repositories 
   {
    mavenCentral()
    }

dependencies {
  compile 'com.edmodo:cropper:1.0.1'
}

Then Clean-Rebuild-Restart-Sync Your Project .

Upvotes: 3

Related Questions