user9347532
user9347532

Reputation:

Failed to resolve: com.android.support:support-compat:27.2.0

I have a problem in the dependencies in my App gradle :

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "fr.android.MyApp"
    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:25.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:support-compat:27.2.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-auth:11.6.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'
}
apply plugin: 'com.google.gms.google-services'

The line that get an error is :

implementation 'com.android.support:animated-vector-drawable:27.1.1'

It says : Failed to resolve: com.android.support:animated-vector-drawable:27.1.1

And :

enter image description here

I also get : Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018.

Here is my build.gradle :

// Top-level build file where you can add configuration options common to all   sub-projects/modules.

buildscript {

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


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:3.1.1'
      }
   }

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

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

Any idea on how to fix this ? Thanks in advance.

Upvotes: 1

Views: 2759

Answers (2)

AtifSayings
AtifSayings

Reputation: 844

It is because you have used older version of appcompat library i.e:

implementation 'com.android.support:appcompat-v7:25.1.1'

change it's version from v7:25.1.1 to 27.1.1

example:

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:support-compat:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-auth:11.6.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'
}

sync your project after changing

Upvotes: 2

hientp
hientp

Reputation: 834

All com.android.support must use the exact same version specification

You use animated-vector-drawable:27.1.1 at version 27.1.1 and support-compat at version 27.2.0. You should make them the same version.

Upvotes: 0

Related Questions