Search code examples
android-studioaar

Error for AAR metadata - Android Studio (kotlin)


3 issues were found when checking AAR metadata:

  1. Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 7.4.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdkVerion of at least 34.

    Note that updating a library or application's compileSdkVersion (which allows newer APIs to be used) can be done separately from updating targetSdkVersion (which opts the app in to new runtime behavior) and minSdkVersion (which determines which devices the app can be installed on).

  2. Dependency 'androidx.core:core-ktx:1.12.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 7.4.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdkVerion of at least 34.

    Note that updating a library or application's compileSdkVersion (which allows newer APIs to be used) can be done separately from updating targetSdkVersion (which opts the app in to new runtime behavior) and minSdkVersion (which determines which devices the app can be installed on).

  3. Dependency 'androidx.core:core:1.12.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

    :app is currently compiled against android-33.

    Also, the maximum recommended compile SDK version for Android Gradle plugin 7.4.2 is 33.

    Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdkVerion of at least 34.

    Note that updating a library or application's compileSdkVersion (which allows newer APIs to be used) can be done separately from updating targetSdkVersion (which opts the app in to new runtime behavior) and minSdkVersion (which determines which devices the app can be installed on).

i was trying to update the Gradle but it already told me that it is up to date.

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    namespace ''
    compileSdk 33

    defaultConfig {
        applicationId ""
        minSdk 24
        targetSdk 33
        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'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.12.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.10.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

I am trying to either use my Android device to test the app or build the APK but so far this error message keeps coming up and i am asking for some assistance.


Solution

  • Try updating the compileSdk from 33 to 34.

    First in the sdk manager download the "Android Api 34".

    Then update in your project: File / Project Structure / Module / Compile Sdk Version / "Select 34 (Api 34)"

    I hope it works for you.