Search code examples
androidandroid-jetpack-composegradle-kotlin-dsl

'androidx.emoji2:emoji2:1.4.0' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs


The project stopped building after importing import androidx.compose.ui.draw.alpha SDK everywhere 33, it shows a dependency conflict

Error log:

An issue was found when checking AAR metadata:

  1.  Dependency 'androidx.emoji2:emoji2:1.4.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.

      Recommended action: Update this project to use a newer compileSdk
      of at least 34, for example 34.

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

My dependencies:

dependencies {

    implementation("androidx.core:core-ktx:1.10.1")
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
    implementation("androidx.activity:activity-compose:1.7.2")
    implementation(platform("androidx.compose:compose-bom:2023.03.00"))

    implementation("androidx.compose.ui:ui")
    implementation("androidx.compose.ui:ui-graphics")

    implementation("androidx.compose.ui:ui-tooling-preview")
    implementation("androidx.compose.material3:material3:1.1.2")
    implementation("androidx.wear.compose:compose-material:1.2.0")
    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.5")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
    androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
    androidTestImplementation("androidx.compose.ui:ui-test-junit4")
    debugImplementation("androidx.compose.ui:ui-tooling")
    debugImplementation("androidx.compose.ui:ui-test-manifest")
}

I tried to change the version (1.4.0 and 1.3.0)

implementation("androidx.compose.ui:ui:1.4.0")
implementation("androidx.compose.ui:ui-graphics:1.4.0")

but it didn't work


Solution

  • You can try updating the compileSdk in the app module's build.gradle to 34.

    The app's behavior won't change until you upgrade the targetSdk (and, as the description of the error says, you don't have to do it right now)