You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级Android Gradle插件后出现403错误,回退版本仍无效

Fixing the Gradle 403 Error When Upgrading Android Gradle Plugin

Hey there, let's sort out that frustrating 403 error you're hitting when trying to download the Gradle distribution. Here's what's going on and how to fix it step by step:

Why This Happens

The 403 response means the server is refusing your request to download gradle-4.4-rc-3-all.zip. This is almost certainly because Gradle's release candidate (RC) versions get pulled down once the official stable version is available. Gradle 4.4 has been out as a stable release for a while now, so the RC-3 build is no longer hosted on services.gradle.org.

Even when you rolled back to Android Gradle Plugin 3.1.0-alpha05, the issue persisted because the Gradle wrapper configuration (which controls which Gradle version your project uses) is independent of the AGP version. Your wrapper was still pointing to the deprecated RC-3 build.

Step-by-Step Fix

1. Update the Gradle Wrapper Configuration

Open the gradle/wrapper/gradle-wrapper.properties file in your project root directory. Look for the distributionUrl line and replace the RC version with the stable Gradle 4.4 release:

Before:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-rc-3-all.zip

After:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

2. Clear Stale Gradle Cache

To avoid any leftover cached files causing issues, delete the old RC-3 distribution folder from your local Gradle cache:

  • On macOS/Linux: Navigate to ~/.gradle/wrapper/dists and delete the folder named something like gradle-4.4-rc-3-all
  • On Windows: Go to C:\Users\<YourUsername>\.gradle\wrapper\dists and delete the corresponding gradle-4.4-rc-3-all folder

3. Sync or Rebuild Your Project

Now, either:

  • Click the "Sync Project with Gradle Files" button in Android Studio, or
  • Run the command in your project root:
    ./gradlew clean build  # macOS/Linux
    gradlew clean build     # Windows
    

This should pull down the stable Gradle 4.4 distribution successfully, and your build should work again with either AGP 3.1.0-alpha05 or alpha06.

内容的提问来源于stack exchange,提问作者user6683139

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:02:24