任务':app:preDebugAndriodTestBuild'的执行失败

我的问题是关于Android Studio中的错误。每次当我尝试在Android Studio中运行Java项目时,我都会收到以下错误,我的程序不起作用:

http://img2.mukewang.com/62ea30f90001b8e615770176.jpg

这是我的 gradle 配置:


apply plugin: 'com.android.application'


android {

    compileSdkVersion 26

    defaultConfig {

        applicationId "com.example.christianmastracco.jsondemo"

        minSdkVersion 22

        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'

}

我该如何解决?谢谢


陪伴而非守候
浏览 121回答 2
2回答

翻过高山走不出你

将 你的 和 更改为 27,这样:compileSdkVersiontargetSdkVersionimplementation 'com.android.support:appcompat-v7:26.1.0'到这个implementation 'com.android.support:appcompat-v7:27.1.0'

临摹微笑

将 和 都更新为版本和实现版本,如错误消息中所示。compileSdkVersiontargetSdkVersion2727.1.1我不能评论Ernest Zamelczyk的答案(声誉50),但我认为正确的答案是,而不是他所说的。27.1.127.1.0
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java