distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://mirrors.aliyun.com/macports/distfiles/gradle/gradle-8.14.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
  • 在 Android 开发中,distributionUrl 配置的 Gradle 和下载的 Gradle 不一致,并且出现如下错误信息
Caused by: org.gradle.api.internal.artifacts.transform.TransformException: Failed to transform gradle-8.14.2-src.zip (gradle:gradle:8.14.2) to match attributes {artifactType=src-directory, org.gradle.status=integration}.
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://services.gradle.org/distributions/gradle-8.14.2-src.zip'.
问题原因
  • distributionUrl 配置的是 -bin.zip(来自阿里云镜像),但构建过程中某个插件或依赖硬编码要求下载 -src.zip(从官方源 services.gradle.org
处理策略
  • 改为使用 -all.zip(阿里云镜像)
distributionUrl=https\://mirrors.aliyun.com/macports/distfiles/gradle/gradle-8.14.2-all.zip
Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐