Android Studio 更新后获得 "Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints"

Getting "Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints" after Android Studio update

更新到最新版本后,我无法再构建 APK,而且我无法理解 gradle 错误。

这是模块配置:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.myapp.mymodule"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 31
        versionName "2.07"
        project.archivesBaseName = "app-name_v" + defaultConfig.versionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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'
    implementation 'ch.acra:acra:4.9.2'

}

这是构建屏幕中显示的错误:

Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints: 
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'ch.acra:acra:4.9.2' --> 'com.android.support:support-annotations:24.1.1'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support.test.espresso:espresso-core:3.0.2' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-vector-drawable:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:design:26.1.0' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:design:26.1.0' --> 'com.android.support:recyclerview-v7:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:design:26.1.0' --> 'com.android.support:transition:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-media-compat:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-utils:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support:appcompat-v7:26.1.0' --> 'com.android.support:support-v4:26.1.0' --> 'com.android.support:support-core-ui:26.1.0' --> 'com.android.support:support-annotations:26.1.0'
   Constraint path 'my-project:my-module:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0
   Constraint path 'my-project:my-module:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0
   Constraint path 'my-project:my-module:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0
   Constraint path 'my-project:my-module:unspecified' --> 'com.android.support:support-annotations' strictly '26.1.0' because of the following reason: debugRuntimeClasspath uses version 26.1.0

应用程序构建完全没有错误,并且可以运行在设备上没有任何问题。

我已经尝试了 中的建议,但其中任何一个都对我有用。

这是gradle.config:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
    }
}

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

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

我想我没有注意正确。在构建日志中:

   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support.test:monitor:1.0.2' --> 'com.android.support:support-annotations:27.1.1'
   Dependency path 'my-project:my-module:unspecified' --> 'com.android.support.test.espresso:espresso-core:3.0.2' --> 'com.android.support.test:runner:1.0.2' --> 'com.android.support:support-annotations:27.1.1'

testImplementation 使用的是它的较高版本。我删除了那些依赖项,现在构建是正确的。我想我需要设置一个较低版本的 testImplementation 以备将来使用。