android build_error ai_generated true

无法解析配置 ':app:debugRuntimeClasspath' 的所有文件。> 找不到 androidx.compose.material3:material3:1.2.0。需要者:项目 :app > > 找不到满足版本约束 '1.2.0' 的 'androidx.compose.material3:material3' 版本

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Could not find androidx.compose.material3:material3:1.2.0. Required by: project :app > > Cannot find a version of 'androidx.compose.material3:material3' that satisfies the version constraint '1.2.0'

ID: android/gradle-version-catalog-not-found

其他格式: JSON · Markdown 中文 · English
92%修复率
87%置信度
1证据数
2023-09-01首次发现

版本兼容性

版本状态引入弃用备注
Android Gradle Plugin 8.0 - 8.2 active
Gradle 8.0 - 8.5 active
Compose BOM 2023.10.01 - 2024.02.00 active

根因分析

版本目录或依赖声明引用了配置的仓库中不存在的库版本,或仓库(如 Maven Central、Google)不可达或缺少该工件。

English

Version catalog or dependency declaration references a library version that does not exist in the configured repositories, or the repository (e.g., Maven Central, Google) is not reachable or missing the artifact.

generic

官方文档

https://developer.android.com/build/dependencies#version-catalog

解决方案

  1. Update the version catalog file (libs.versions.toml) to use a valid version from the Google Maven repository: 'material3 = "1.2.1"' and then run 'gradlew clean build'.
  2. Add the Google Maven repository explicitly in settings.gradle or build.gradle: 'maven { url "https://maven.google.com" }' and ensure it's before other repositories.

无效尝试

常见但无效的做法:

  1. 50% 失败

    If the repository is already present but the artifact doesn't exist, adding it again won't help; the version must be verified.

  2. 50% 失败

    Older versions may not be compatible with the current Compose or AndroidX libraries, causing other build failures.