1

I'm getting the following errors when trying to add implementation 'com.android.support:cardview-v7:27.1.1' to my build.gradle (app):

Unable to resolve dependency for ':app@debug/compileClasspath': Could not 
resolve com.android.support:cardview-v7:27.1.1.

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': 
Could not resolve com.android.support:cardview-v7:27.1.1.

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': 
Could not resolve com.android.support:cardview-v7:27.1.1.

Unable to resolve dependency for ':app@release/compileClasspath': Could not 
resolve com.android.support:cardview-v7:27.1.1.

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': 
Could not resolve com.android.support:cardview-v7:27.1.1.

Here is my App gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "afinal.recipe.p.recipe1"
        minSdkVersion 22
        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:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-media-compat:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    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'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
}
apply plugin: 'com.google.gms.google-services'

And my Project 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.2.1'
        classpath 'com.google.gms:google-services:4.0.1'

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

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }
        mavenCentral()
    }
}

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

I've already been stuck on this for a while and tried a variety of solutions with no success such as ensuring offline mode isn't checked and changing

apply plugin: 'com.android.application'

to:

apply plugin: 'com.android.library'

and, without success, deleting:

applicationId "afinal.recipe.p.recipe1"

Thanks in advance for any help, would be greatly appreciated.

RiceCrispy
  • 41
  • 6
  • Try take a look at this https://stackoverflow.com/questions/54436935/android-studio-gradle-warning-all-com-android-support-libraries-must-use-the/54453738#54453738 – Infinite Loops Feb 09 '19 at 04:02
  • 1
    Thanks for the reply, I tried this not long after posting the question and it did solve the issue. For anyone coming across the same problem: Instead of using: implementation 'com.android.support:cardview-v7:27.1.1' I changed it to the latest version: implementation 'com.android.support:cardview-v7:28.0.0' – RiceCrispy Feb 09 '19 at 16:05

0 Answers0