stackoverflow9949
stackoverflow9949

Reputation: 51

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

I am new to Android development and I am trying to implement the MVVM (with Room & Retrofit) architecture but I am getting the following error :

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.

My build.gradle (app) is as follows :

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"

}

My build.grade (project) is as follows :

// 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'
}

Is there anyway to solve this issue ? Please let me know. ...........................................................................................................................................................................................................................................................................................................................

Upvotes: 1

Views: 443

Answers (1)

Farid
Farid

Reputation: 1096

The APIs in lifecycle-extensions have been deprecated. Instead, add dependencies for the specific Lifecycle artifacts you need.

More Info at https://developer.android.com/jetpack/androidx/releases/lifecycle.

You can use the new version 2.3.1

Upvotes: 1

Related Questions