One or more issues found when checking AAR metadata values:

11,377

Change your compileSdk 30 to 31.

It worked for me!

   compileSdk 31

    defaultConfig {
        applicationId "com.example.lifecycle"
        minSdk 21
        targetSdk 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
Share:
11,377

Related videos on Youtube

vivek modi
Author by

vivek modi

Updated on June 15, 2022

Comments

  • vivek modi
    vivek modi almost 2 years

    Hey I am trying to run my application and I am getting this error

    build.gradle

    plugins {
        id 'com.android.application'
        id 'kotlin-android'
        id 'kotlin-kapt'
    }
    
    android {
        compileSdk 30
    
        configurations.all {
            resolutionStrategy { force 'androidx.core:core-ktx:1.7.0-alpha01' }
        }
    
        defaultConfig {
    
            applicationId "com.example.listadapter"
            minSdk 21
            targetSdk 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
        }
        kotlinOptions {
            jvmTarget = '1.8'
        }
    
        buildFeatures {
            viewBinding true
        }
    }
    
    dependencies {
    
        implementation 'androidx.core:core-ktx:1.7.0'
        implementation 'androidx.appcompat:appcompat:1.3.1'
        implementation 'com.google.android.material:material:1.4.0'
        implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
        testImplementation 'junit:junit:4.+'
        androidTestImplementation 'androidx.test.ext:junit:1.1.3'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    
        implementation "com.squareup.retrofit2:converter-moshi:2.5.0"
        implementation 'com.squareup.okhttp3:logging-interceptor:4.9.1'
        implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    
        implementation "com.squareup.moshi:moshi:1.12.0"
        implementation "com.squareup.moshi:moshi-kotlin:1.12.0"
    
        implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
        implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0"
        implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
        implementation "android.arch.lifecycle:extensions:1.1.1"
        implementation 'androidx.fragment:fragment-ktx:1.3.6'
    }
    

    I tried this All Example from this link it's not working

    getting error after installing the application. I just created a new application. I don't understand why this is causing it. Does anyone know how to solve this problem? Thanks in adavance.

    One or more issues found when checking AAR metadata values:
    
    The minCompileSdk (31) specified in a
    dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
    is greater than this module's compileSdkVersion (android-30).
    Dependency: androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0.
    AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/b7f9608e476cb2e496993f185af8912c/transformed/jetified-lifecycle-viewmodel-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
    
    The minCompileSdk (31) specified in a
    dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
    is greater than this module's compileSdkVersion (android-30).
    Dependency: androidx.lifecycle:lifecycle-runtime-ktx:2.4.0.
    AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/538fea46e89a6c8a3e3eec533224abb8/transformed/jetified-lifecycle-runtime-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
    
    The minCompileSdk (31) specified in a
    dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
    is greater than this module's compileSdkVersion (android-30).
    Dependency: androidx.lifecycle:lifecycle-livedata-ktx:2.4.0.
    AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/6a1f77e99280b09902894e4ae8301047/transformed/jetified-lifecycle-livedata-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
    
    The minCompileSdk (31) specified in a
    dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
    is greater than this module's compileSdkVersion (android-30).
    Dependency: androidx.lifecycle:lifecycle-viewmodel:2.4.0.
    AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/41cf6125c3fd7a33d28222cf07d20520/transformed/lifecycle-viewmodel-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
    
    The minCompileSdk (31) specified in a
    dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
    is greater than this module's compileSdkVersion (android-30).
    Dependency: androidx.lifecycle:lifecycle-runtime:2.4.0.
    AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/655163560a267a5b16e2f66044d78641/transformed/lifecycle-runtime-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
    
    The minCompileSdk (31) specified in a
    dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
    is greater than this module's compileSdkVersion (android-30).
    Dependency: androidx.lifecycle:lifecycle-livedata:2.4.0.
    AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/1ca84d966e72f2f06b580da1765a55a5/transformed/lifecycle-livedata-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
    
    The minCompileSdk (31) specified in a
    dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
    is greater than this module's compileSdkVersion (android-30).
    Dependency: androidx.lifecycle:lifecycle-livedata-core-ktx:2.4.0.
    AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/3ed4d52253be7f6d85cbabee72c886d3/transformed/jetified-lifecycle-livedata-core-ktx-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
    
    The minCompileSdk (31) specified in a
    dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
    is greater than this module's compileSdkVersion (android-30).
    Dependency: androidx.lifecycle:lifecycle-livedata-core:2.4.0.
    AAR metadata file: /Users/vmodi/.gradle/caches/transforms-3/4e8a32482e233cfbbc450e03aabed8dd/transformed/lifecycle-livedata-core-2.4.0/META-INF/com/android/build/gradle/aar-metadata.properties.
    

    If i change my compileSdk 31 it gives me another error.

    Could not resolve all files for configuration ':app:androidApis'.
    Failed to transform android.jar to match attributes {artifactType=android-mockable-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, returnDefaultValues=false}.
    Execution failed for MockableJarTransform: /Users/vmodi/Library/Android/sdk/platforms/android-31/android.jar.
    Cannot create mockable android.jar
    /Users/vmodi/Library/Android/sdk/platforms/android-31/android.jar
    
  • MD. RAKIB HASAN
    MD. RAKIB HASAN over 2 years
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
  • Yunnosch
    Yunnosch over 2 years
    Please make more obvious what additional insight this post is supposed to contribute when compared to the other existing answers.
  • Dildarkhan Pathan
    Dildarkhan Pathan over 2 years
    This works for me, First download Android 12 (API 31), then change compileSdk and targetSdk to 31 and sync. It works for me. Thanks
  • nnhthuan
    nnhthuan over 2 years
    You're welcome mate.