天天看點

Gradle:Download https:// jcenter.bintray.com/ 下載下傳緩慢解決方法

方案一:切換鏡像倉庫

(原文位址)

阿裡的倉庫位址(親測有效):http://maven.aliyun.com/nexus/content/groups/public/

OSChina的倉庫位址:http://maven.oschina.net/content/groups/public/

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

buildscript {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
        google()
        jcenter()
    }
}

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 'http://maven.aliyun.com/nexus/content/repositories/central/'}
//        maven()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
//        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
//        maven()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        google()
        jcenter()
    }
}

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

           

方案二:更換本地Gradle

(原文位址)

未經測試,自行查閱原文 O(∩_∩)O~~