无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:

问题描述 投票:1回答:1

我目前正在使用Android Studio 3.0,我刚刚创建了项目,gradle离线工作已经被禁用,它说

Error:Unable to resolve dependency for 
  ':app@debugAndroidTest/compileClasspath': Could not resolve 
com.android.support:appcompat-v7:26.0.0-beta1.
   <a href="openFile:C:/Users/ivan/AndroidStudioProjects/Notification/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Could not resolve com.android.support:appcompat-v7:26.0.0-beta1.">Show Details</a>

screen shot

Build Gradle app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.ivan.notification"
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.0.0-beta1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:0.5'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
}
android
1个回答
0
投票

从appcompat支持库依赖项中删除-beta1:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:0.5'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
}

然后,同步您的项目。

© www.soinside.com 2019 - 2024. All rights reserved.