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

Android Studio 3.1升级后Gradle项目同步失败求助

Fixing Gradle Sync Failure After Android Studio 3.1 Update

Hey there, sorry to hear you're stuck with this frustrating Gradle sync issue right after updating to Android Studio 3.1. That HttpRequestException usually points to a problem accessing Google's Maven repository, so let's walk through some tried-and-true fixes to get you back up and running:

  • Verify network access and proxy settings

    • First, test if you can reach the problematic URL directly: open https://dl.google.com/dl/android/maven2/org/jetbrains/annotations/13.0/annotations-13.0.pom in your browser. If it doesn't load, your network might be blocking access to Google's Maven repo.
    • Check Android Studio's proxy config: go to File > Settings > Appearance & Behavior > System Settings > HTTP Proxy. Make sure your proxy settings are correct (if you use one), or try switching to "No proxy" temporarily to rule out proxy issues.
    • Also check your global Gradle proxy settings: open ~/.gradle/gradle.properties (on Windows it's C:\Users\<YourName>\.gradle\gradle.properties) and look for lines like systemProp.http.proxyHost — comment them out if you don't need a proxy anymore.
  • Clear Gradle and IDE caches

    • Corrupted cache files are a common culprit here. Delete the .gradle/caches folder (you'll find this in your project root directory, or in your user home folder's .gradle directory).
    • Alternatively, use Android Studio's built-in tool: go to File > Invalidate Caches / Restart, then select "Invalidate and Restart". This will clear both IDE and Gradle caches in one go.
  • Double-check your build.gradle repository config

    • Make sure your project's root build.gradle has the correct Google repository setup. It should look like this:
      buildscript {
          repositories {
              google()
              jcenter()
          }
          // ... other dependencies
      }
      
      allprojects {
          repositories {
              google()
              jcenter()
          }
      }
      
    • If you're still using the old maven { url 'https://dl.google.com/dl/android/maven2/' } syntax, try replacing it with google() — it's the official shorthand and less prone to typos.
  • Temporarily downgrade the Gradle plugin (if needed)

    • Sometimes the latest Android Studio version has compatibility issues with older projects. You can try rolling back the Gradle plugin version in your root build.gradle:
      dependencies {
          classpath 'com.android.tools.build:gradle:3.0.1' // Switch to a stable older version
      }
      
    • Sync the project after making this change — if it works, you can later investigate what's causing the compatibility issue with 3.1.
  • Check firewall/antivirus interference

    • Local firewalls or antivirus software might be blocking Android Studio's outgoing requests. Try temporarily disabling them, then run a Gradle sync again to see if that fixes the problem.

If none of these steps work, feel free to share more details from the Gradle sync log — that can help narrow down the issue further.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 04:17:35