解決android studio引用遠程倉庫下載慢(JCenter下載慢)


使用開源中國的maven庫

阿里雲的(速度飛快):http://maven.aliyun.com/nexus/content/groups/public/

修改項目根目錄下面的build.gradle文件,將jcenter()庫注釋掉,添加阿里的maven庫,同時保留Google的maven庫地址即可。

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        //jcenter()
        maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}       
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

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

 另一個方法,在android studio的設置里面添加如下設置,下次就不用再改動這個文件了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM