Android Studio Gradle Project Sync - Failed to resolve espresso core and Appomppat [SOLVED]

Edit: Issues are now fixed by completely reinstalling Android Studio and the Java SDK.

As I begin my adventure in application development, I follow the First App tutorial, which is located at https://developer.android.com/training/basics/firstapp/index.html . However, when I create the “Empty Action” project by default and try to create it, I get the following errors:

- Error:(23, 24) Failed to resolve: com.android.support.test:espresso-core:2.2.2
- Error:(26, 13) Failed to resolve: com.android.support:appcompat-v7:26.+

My (default / autogenerated) build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.example.myfirstapp"
        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'
}

, , . Android Studio 2.3.3 . , - , , .

, Oli

+4
6

, !

, , Android Studio Java SDK . , , , Android, !

, Oli

-1

, repository google maven.
- :

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

. docs.

+5

'com.android.support:appcompat-v7:26.0.0-alpha1'

+3

compile 'com.android.support:appcompat-v7:25.3.1'

+ .

SDK / . .

0

compile 'com.android.support:appcompat-v7:26.0.0-alpha1' :)

0

gradle 4.1

.

build.gradle

*implementation 'com.android.support:appcompat-v7:26.0.0'*

gradle

*classpath 'com.android.tools.build:gradle:3.0.0-alpha8'*
0

Source: https://habr.com/ru/post/1679070/


All Articles