Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am getting below error in my new Android studio version basic hello world is also not building in gradle. cloud you please help on the same.

This is the error I am getting in new android studio version :

This is the error I am getting in new android studio version

My gradle file is as below

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "payments.com.java.payments"
        minSdkVersion 17
        targetSdkVersion 28
        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(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    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'
}

This is the logs i am getting

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-rc01. Open File Show Details

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2. Open File Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.test:runner:1.0.2. Open File Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.test.espresso:espresso-core:3.0.2. Open File Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-rc01. Open File Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2. Open File Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-rc01. Open File Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2. Open File Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-rc01. Open File Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2. Open File Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-rc01. Open File Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.2. Open File Show Details

like image 534
user2454202 Avatar asked Aug 07 '18 19:08

user2454202


2 Answers

Check your internet connectivity. For me it was just internet connectivity problem. If you are under a proxy server. Go to File > Settings > Appearance & Behavior >System Settings >HTTP Proxy and enter your proxy details there. Use the check connection option to verify your connection. Here is a reference to my gradle file.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
       applicationId "com.oops.pk.birthday_card"
       minSdkVersion 23
       targetSdkVersion 28
       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(dir: 'libs', include: ['*.jar'])
     implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
     implementation 'com.android.support:support-v4:28.0.0'
     implementation 'com.android.support:recyclerview-v7:28.0.0'
     implementation 'com.android.support:design:28.0.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'
 }
like image 154
Pike Avatar answered Sep 28 '22 06:09

Pike


I use Shadowsocks proxy in China, open ~/.gradle/gradle.properties and comment https host and port

#systemProp.https.proxyPort=1080
systemProp.http.proxyHost=127.0.0.1
#systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080

after that, create new project again or build your project again, done

like image 24
duyuanchao Avatar answered Sep 28 '22 05:09

duyuanchao