Android 开发问题:core-ktx 版本与 compileSdkVersion 冲突
2026/6/17 17:06:35 网站建设 项目流程
implementation'androidx.core:core-ktx:1.10.1'
  • 在 Android 开发中,引入了androidx.core:core-ktx:1.10.1库后,运行项目时,出现如下错误信息
3 issues were found when checking AAR metadata: 1. Dependency 'androidx.core:core-ktx:1.10.1' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app3 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.10.1' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs. :app3 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. :app3 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).
问题原因
  1. 引入的androidx.core:core-ktx:1.10.1库要求项目的 compileSdkVersion 至少为 33

  2. 而当前的 compileSdkVersion 为 32

处理策略
  1. 方案 1:升级 compileSdkVersion 到 33
android{compileSdk33}
  1. 方案 2:降级core-ktx1.8.01.9.0版本
implementation'androidx.core:core-ktx:1.8.0'

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询