Pikachuu
Pikachuu

Reputation: 155

Why does it give me a "Failed to resolve" error in Android Studio?

I am trying to learn Android and I tried to make an example from a tutorial. I have to include two libraries in the build.gradle, but when I sync the project with the gradle files it gives me this error: "Failed to resolve".

Here is the dependecies part from build.gradle:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.loopj.android:android-async-http:1.4.4'
compile 'com.squareup.picasso:picasso:2.1.1'

}

Is there somethig wrong with the versions of the libraries or is it something else?

Upvotes: 1

Views: 7415

Answers (4)

masoud Cheragee
masoud Cheragee

Reputation: 360

in my case adding mavencentral to gradle worked I took it from here

Could not find com.squareup.picasso:picasso:2.5.2

enter repositories {
    jcenter()
    mavenCentral()
}

Upvotes: 0

nati
nati

Reputation: 1

1.download the jar file of picasso from this site square.github.io/picasso/ 2.add the jar file to your app/lib folder 3.from android studio go to file/project structure/dependency then click on the blue + button then jar dependency from the lib folder select picasso at last press ok

Upvotes: 0

Byte Brad
Byte Brad

Reputation: 2357

So it unable to resolve the jar! So I believe you missing jcenter() in your build.gradle. Your build.gradle should look like this

repositories {
    jcenter()
}

And your'e using older version of picasso library, the new version is 2.5.2

Still if face the problem you can download the JAR and add to libs folder.

You can find jar from this link

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363737

In your build.gradle you have to add:

repositories {
    jcenter()
}

Gradle has to know where to download the aar files.

Pay attention to your example. You are using picasso:2.1.1.
It is a very old version.
Here you can find all releases of this library.

Upvotes: 3

Related Questions