Newaj
Newaj

Reputation: 4448

Failed to resolve: com.squareup.retrofit2:retrofit:2.3.0

I tried to include retrofit library in android studio 2.2.3. I added the following line in gradle

compile 'com.squareup.retrofit2:retrofit:2.3.0'

But it is giving me the following error :

Failed to resolve: com.squareup.retrofit2:retrofit:2.3.0

What is the solution?

Upvotes: 1

Views: 9985

Answers (6)

Change your version to a newer version

implementation 'com.squareup.retrofit2:retrofit:2.4.0'

Upvotes: 0

Badr Bujbara
Badr Bujbara

Reputation: 8691

I needed to declare google() in both buildscripts and allobjects

    buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0-alpha06'

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

allprojects {
    repositories {
        jcenter()
        google()
    }
}

Upvotes: 0

Stargazer Baltic
Stargazer Baltic

Reputation: 51

Check if you are not running an OFFLINE WORK, in settings> Build, Execution, Deployment > Gradle at the bottom, Offline work should not be checked.

Upvotes: 1

Mahdi-Malv
Mahdi-Malv

Reputation: 19268

The case also can be proxy too.
Disable proxy from Settings > Appearance and behaviour > System Settings > Http proxy
by checking No Proxy and also clear proxy lines from gradle.properties (Global properties) if you have one.

Upvotes: 0

Siva agarwal
Siva agarwal

Reputation: 107

put compile 'com.squareup.retrofit2:retrofit:2.3.0' in build.gradle(Module:app) and sync the project.It should work fine without any errors

Upvotes: 0

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75798

Failed to resolve: com.squareup.retrofit2:retrofit:2.3.0.

Retrofit requires at minimum Java 7 or Android 2.3.

You are not using android studio Version 2.3 . Upgrade your Studio version .

How to check Version .

 File > Settings-> Appearance & Behaviour -> System Settings -> Updates

Upvotes: 1

Related Questions