Search code examples
androidxmlkotlingradlemobile

Android Studio error "requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs."


All libraries are updated.

Library versions:

implementation 'androidx.annotation:annotation-experimental:1.3.0'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.core:core:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-database:20.0.6'
implementation 'com.google.firebase:firebase-config-ktx:21.1.2'
implementation 'com.google.firebase:firebase-config:21.1.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.github.denzcoskun:ImageSlideshow:0.1.0'
implementation("com.android.volley:volley:1.2.1")

Error:

3 issues were found when checking AAR metadata:

  1. Dependency 'androidx.core:core-ktx:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.

    Recommended action: Update this project to use a newer compileSdkVersion of at least 33, for example 33. 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:1.9.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.

    Recommended action: Update this project to use a newer compileSdkVersion of at least 33, for example 33. 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.annotation:annotation-experimental:1.3.0' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app is currently compiled against android-32.

    Recommended action: Update this project to use a newer compileSdkVersion of at least 33, for example 33. 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).

How can I fix this?


Solution

  • There are two ways to fix this error:

    1. Increase compileSdk, targetSdk values from 32 to 33 in build.gradle file (app level).
    2. (Not recommended) Decrease dependencies in build.gradle to old values:
    implementation 'androidx.core:core-ktx:1.8.0' 
    implementation 'androidx.appcompat:appcompat:1.5.0'

    After these changes - resync the project with Gradle files.

    But it is best to use the first way, as it is necessary to support Android 13.