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.pomin 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'sC:\Users\<YourName>\.gradle\gradle.properties) and look for lines likesystemProp.http.proxyHost— comment them out if you don't need a proxy anymore.
- First, test if you can reach the problematic URL directly: open
Clear Gradle and IDE caches
- Corrupted cache files are a common culprit here. Delete the
.gradle/cachesfolder (you'll find this in your project root directory, or in your user home folder's.gradledirectory). - 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.
- Corrupted cache files are a common culprit here. Delete the
Double-check your build.gradle repository config
- Make sure your project's root
build.gradlehas 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 withgoogle()— it's the official shorthand and less prone to typos.
- Make sure your project's root
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.
- Sometimes the latest Android Studio version has compatibility issues with older projects. You can try rolling back the Gradle plugin version in your root
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
相关产品推荐
相关产品推荐

