繁体   English   中英

任务 ':app:checkDebugAarMetadata' 执行失败 - Android 生命周期扩展

[英]Execution failed for task ':app:checkDebugAarMetadata' - Android Lifecycle Extentions

我是 Android 开发的新手,我正在尝试实现 MVVM(带 Room & Retrofit)架构,但出现以下错误:

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find androidx.lifecycle:lifecycle-extentions:2.2.0.

我的build.gradle(app)如下:

plugins {
    id 'com.android.application'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {
    applicationId "com.example.mvvmpractice"
    minSdkVersion 19
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"

    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.2.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'

//  Retrofit
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

//  Glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.google.android.material:material:1.0.0'

//  Room Components
implementation 'android.arch.persistence.room:runtime:1.0.0'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
//kapt 'android.arch.persistence.room:compiler:1.0.0'

//  Lifecycle Components
implementation "androidx.lifecycle:lifecycle-extentions:$rootProject.archLifecycleVersion"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$rootProject.archLifecycleVersion"

//  UI
implementation "com.google.android.material:material:$rootProject.materialVersion"

//  Testing
androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"

}

我的 build.grade(项目)如下:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
    google()
    jcenter()
}
dependencies {
    classpath "com.android.tools.build:gradle:4.1.3"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

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

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

ext {
roomVersion = '2.2.1'
archLifecycleVersion = '2.2.0'
coreTestingVersion = '2.1.0'
materialVersion = '1.0.0'
}

有没有办法解决这个问题? 请告诉我。 ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... ..................................................... …………………………………………………………………………

生命周期扩展中的 API 已被弃用。 相反,为您需要的特定生命周期工件添加依赖项。

更多信息请访问https://developer.android.com/jetpack/androidx/releases/lifecycle

您可以使用新版本 2.3.1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM