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
            }
        }
    }
    
  • 相关阅读:
    《经济学通识》六、生命有限
    《经济学通识》五、反垄断的罪与罚
    《经济学通识》四、贸易与互惠
    《经济学通识》三、价格与市场
    《经济学通识》二、管制的愿望与结果
    《经济学通识》一、前言
    《必然》十三、开始,正从脚下开始
    《必然》十二、一个好问题足以改变世界
    字符串之strstr
    STL之内存处理工具
  • 原文地址:https://www.cnblogs.com/lightice/p/14779984.html
Copyright © 2011-2022 走看看