关于android studio 出现Error:Execution failed for task ':app:preDebugAndroidTestBuild'. 的解决办法

于是便查看app下build.gradle文件,发现并没有错误compileSdkVersion 为26,可是没有发现27.1.1版本的com.android.support:support-annotations。可是上述信息明显是版本冲突,于是在external library中寻找

删除27.

 导入项目一般错误会出现很多,先把版本

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.wx.com.wxvoicemerge"
        minSdkVersion 23
        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.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'
}
原文地址:https://www.cnblogs.com/zuochanzi/p/12326713.html