首页 > 解决方案 > Android构建项目错误:任务执行失败

问题描述

我是 Android Studio 的新手,如果我删除 Room Library,我不知道这是什么问题 它可以工作,但有 Room Dependency 它有错误,我从我的项目文件夹中删除了 Build 和 .gradle 文件夹,没关系你能帮我? 构建错误

我的 Build.gradle :

它的房间图书馆问题??

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.example.mvp_sample_todolist"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary(true)

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    def room_version = "2.3.0"

    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"

}

标签: javaandroidandroid-studio

解决方案


如果 vpn 已打开,请确保您的 vpn 已打开,更改您的 gradle 插件版本


推荐阅读