Problem with gradle sync

3

I just installed Android Studio , and you're giving me this error all the time:

Failed to resolve: com.android.support.test.espresso:espresso-core:2.2.2
Failed to resolve: com.android.support: appcompat-v7:26

Any suggestions as to why it may be?

Build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.example.alejandro.primeraapp"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}        
    
asked by hugoboss 20.07.2017 в 10:56
source

2 answers

0

Update your espresso version to 2.2.2:

 'com.android.support.test.espresso:espresso-core:2.2.2'

Review the documentation:

link

Regarding:

 com.android.support: appcompat-v7:26

Make sure you have this version installed, you can see in the message and click on Install repository and sync proyect for this.

    
answered by 20.07.2017 в 11:44
0

Normally, an error of type Failed to resolve means that the gradle can not find the file in its library and that it could not download it either .

Check if Android Studio has access to Internet and if its components also have it, check the firewall.

Also check in the gradle window that you do not have it in offline mode, in this mode you are not able to download anything.

Finally, check that you have the android-sdk installed and that you have access to the Internet.

    
answered by 05.08.2017 в 21:16