更改后无法同步android gradle

时间:2018-06-19 14:51:39

标签: android

**apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.angel.myapplication"
        minSdkVersion 21
        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'
        }
    }
}
***strong text***

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    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'
}**

给出此错误 错误:任务':app:preDebugAndroidTestBuild'的执行失败。 >与项目':app'中的依赖项'com.android.support:support-annotations'冲突。应用(26.1.0)和测试应用(27.1.1)的已解决版本不同。有关详细信息,请参见https://d.android.com/r/tools/test-apk-dependency-conflicts.html

1 个答案:

答案 0 :(得分:0)

如何将此行添加到gradle文件中?

implementation 'com.android.support:support-annotations:27.1.1'

并再次同步您的项目。