Skip to content

加速 build.gradle 的下载速度

找到 build.gradle 文件,修改成如下

bash
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
      maven { url 'https://maven.aliyun.com/repository/google' }
      maven { url 'https://maven.aliyun.com/repository/jcenter'}
      maven { url 'https://maven.aliyun.com/repository/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.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/repository/public' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
      maven { url 'https://maven.aliyun.com/repository/google' }
      maven { url 'https://maven.aliyun.com/repository/jcenter'}
      maven { url 'https://maven.aliyun.com/repository/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.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/repository/public' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

方案二

在用户目录下的 .gradlegradle.properties 设置代理

ini
systemProp.https.proxyPort=1087
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=1087
systemProp.https.proxyPort=1087
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=1087

最后编辑时间:

Version 4.0 (framework-1.0.0-rc.20)