Android Studio 3.1.2中Gradle持续下载builder-3.1.2.jar异常缓慢求助
Hey there, I totally get how frustrating this is—you’re excited to start building your first Android app, and Gradle’s snail-paced downloads are killing your momentum. Since you already confirmed the direct download works fine, the issue is almost certainly with how Gradle is handling the request. Let’s try these practical fixes:
1. Switch to Domestic Maven Mirrors
The default Google and JCenter repositories can be slow in some regions. Replace them with faster domestic mirrors in your project’s root build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { // Replace default repos with these mirrors maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'https://maven.aliyun.com/nexus/content/groups/public' } } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' } } allprojects { repositories { maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'https://maven.aliyun.com/nexus/content/groups/public' } } }
After making this change, sync your project—Gradle should pull dependencies from the faster mirrors instead.
2. Manually Place the Downloaded Jar in Gradle Cache
Since you already downloaded builder-3.1.2.jar quickly via browser, you can manually put it into Gradle’s local cache so it doesn’t try to re-download it:
- Find your Gradle cache directory: On Windows it’s
C:\Users\<YourUsername>\.gradle\caches\modules-2\files-2.1\com.android.tools.build\builder\3.1.2, on macOS/Linux it’s~/.gradle/caches/modules-2/files-2.1/com.android.tools.build/builder/3.1.2 - Inside this folder, there should be a subfolder with a long hash string (this is unique for each dependency). If the folder doesn’t exist, create it.
- Copy your downloaded
builder-3.1.2.jarinto this folder, then restart Android Studio and trigger a build sync.
3. Tweak Gradle VM Settings for Better Performance
Sometimes Gradle runs out of memory during downloads, causing slowdowns. Open the gradle.properties file in your project (or the global one in your .gradle folder) and add/update these lines:
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.parallel=true org.gradle.daemon=true
Enabling the daemon and parallel builds can also speed up subsequent builds once dependencies are cached.
4. Verify Proxy Settings
If you’re using a proxy (either system-wide or in Android Studio), it might be throttling Gradle’s downloads. Go to File > Settings > Appearance & Behavior > System Settings > HTTP Proxy and make sure:
- If you don’t need a proxy, select No proxy
- If you do use a proxy, ensure the settings are correct (including any authentication credentials)
After checking, restart Android Studio and try syncing again.
One last thing: Make sure you’re using the latest version of Gradle compatible with Android Studio 3.1.2 (which is exactly 3.1.2, as you have). Sometimes mismatched versions can cause unexpected issues too.
Hope one of these fixes gets your build moving—happy coding!
内容的提问来源于stack exchange,提问作者selimgrr

