zoukankan      html  css  js  c++  java
  • android studio更换成阿里源

    参考:https://www.cnblogs.com/qianmaoliugou/p/12369654.html

    1.android studio更换成阿里源

    在根目录中的bulid.gradle更改内容

    buildscript {
        repositories {
            maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
    //        google()
    //        mavenCentral()
        }
        dependencies {
            classpath "com.android.tools.build:gradle:4.2.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/groups/public/' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
    //        google()
    //        mavenCentral()
    //        jcenter() // Warning: this repository is going to shut down soon
        }
    }
    

    2.对所有项目都生效

    在用户/.gradle/下创建init.gradle文件

    allprojects{
        repositories {
            def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
            def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
            all { ArtifactRepository repo ->
                if(repo instanceof MavenArtifactRepository){
                    def url = repo.url.toString()
                    if (url.startsWith('https://repo1.maven.org/maven2')) {
                        project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
                        remove repo
                    }
                    if (url.startsWith('https://jcenter.bintray.com/')) {
                        project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
                        remove repo
                    }
                }
            }
            maven {
                    url ALIYUN_REPOSITORY_URL
                url ALIYUN_JCENTER_URL
            }
        }
    }
    
  • 相关阅读:
    BZOJ 2002: [Hnoi2010]Bounce 弹飞绵羊
    众王谈判三 谈判
    众王谈判二 来客
    众王谈判一 陨星
    边缘长梦
    Lua笔记
    来从蜀国游 5
    来从蜀国游 4
    来从蜀国游 3
    来从蜀国游 2
  • 原文地址:https://www.cnblogs.com/lightice/p/14779984.html
Copyright © 2011-2022 走看看