“androidx.emoji2:emoji2:1.4.0”需要依赖它的库和应用程序才能针对版本 34 或更高版本的 Android API 进行编译

Gra*_*oat 3 android gradle-kotlin-dsl android-jetpack-compose

到处导入SDK后项目停止构建import androidx.compose.ui.draw.alpha 33,显示依赖冲突

错误日志:

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).
Run Code Online (Sandbox Code Playgroud)

我的依赖项:

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")
}
Run Code Online (Sandbox Code Playgroud)

我尝试更改版本(1.4.0和1.3.0)

implementation("androidx.compose.ui:ui:1.4.0")
implementation("androidx.compose.ui:ui-graphics:1.4.0")
Run Code Online (Sandbox Code Playgroud)

但没用

Vla*_*iev 5

您可以尝试将模块compileSdk中的更新为 34。appbuild.gradle

在您升级之前,应用程序的行为不会改变targetSdk(并且,正如错误描述所述,您现在不必立即执行此操作)