A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction

682 Views Asked by At

Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction i'm getting this error while running the app idon't know why. help!

buld.gradle(Module:app)

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}

android {
    namespace 'com.example.adore'
    compileSdk 32

    defaultConfig {
        applicationId "com.example.adore"
        minSdk 24
        targetSdk 32
        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_11
        targetCompatibility JavaVersion.VERSION_11
    }
    buildFeatures {
        viewBinding true
    }
}

dependencies {

    implementation platform('com.google.firebase:firebase-bom:32.2.2')
    implementation 'com.google.firebase:firebase-analytics'

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.9.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.annotation:annotation:1.6.0'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
    implementation 'com.google.firebase:firebase-auth:22.1.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

build.gradle(project)

  buildscript {
        dependencies {
            classpath 'com.google.gms:google-services:4.3.15'
        }
    }// Top-level build file where you can add configuration options common to all sub-projects/modules.
    plugins {
        id 'com.android.application' version '8.1.0' apply false
        id 'com.android.library' version '8.1.0' apply false
        id 'com.google.gms.google-services' version '4.3.15' apply false
    }
1

There are 1 best solutions below

0
Asgar Abbas On

First Upgrade the sdk

android {

compileSdk 33 //update compileSdk

defaultConfig {
   
    targetSdk 33 //update targetSdk
  
}

after run , if show Duplicate class then Add the below line in your build.gradle(Module:app)

dependencies {

    (...)

    // Fix Duplicate class
    implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
  
}