2

we created a new project in Android Studio but our application doesn't be run. (we have the latest version of Android Studio and SDK)

you can check error message below:

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


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


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


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


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


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


Failed to resolve: com.android.support:appcompat-v7:28.0.0-rc02
Show in File
Show in Project Structure dialog


Failed to resolve: com.android.support.constraint:constraint-layout:1.1.3
Show in File
Show in Project Structure dialog

you can check Build.gradle (placed in project root directory) below:

    // 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.4'


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

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

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

where is the issue? how can we solve it?

Amin Shabanzadeh
  • 301
  • 2
  • 11
  • It's mostly because of your IP. Is gradle offline mode enabled in `File -> Settings - > Build & ..` ? If so, try to disable it. Unfortunately, Iranian IPs are blocked for downloading dependencies by AS so, this might cause the issue in this case. – ʍѳђઽ૯ท Sep 17 '18 at 20:08
  • offline mode is not enabled. also i'm using VPN. – Amin Shabanzadeh Sep 17 '18 at 20:13
  • Can you also paste your `Build.gradle` of the project root directory? which contains repository? That would be great. – ʍѳђઽ૯ท Sep 17 '18 at 20:16
  • See if [this](https://stackoverflow.com/questions/46949622/android-studio-3-0-unable-to-resolve-dependency-for-appdexoptions-compileclas) helps – Soon Santos Sep 17 '18 at 20:19
  • ʍѳђઽ૯ท question updated. – Amin Shabanzadeh Sep 17 '18 at 20:38
  • Soon Santos I visited this but my issue didn't solve. – Amin Shabanzadeh Sep 17 '18 at 20:40
  • @AminShabanzadeh I’m guessing that the VPN you used is not tunneling the android studio and all I can suggest is to reopen or use a new VPN then Reinvalidate-caches restart the Android Studio. By using the right app like OpenVpns or etc, it will be solved i hope – ʍѳђઽ૯ท Sep 17 '18 at 20:50
  • ok i'll try it. is correct this line of gradle-wrapper.properties file: distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip – Amin Shabanzadeh Sep 17 '18 at 20:55
  • my vpn is opening developers area of android site without any issue! I could update android studio properly.so my VPN is working fine – Amin Shabanzadeh Sep 17 '18 at 21:01

0 Answers0