• android gradle使用阿里源


    使用阿里源

    新建一个init.gradle 文件到$USER_HOME/.gradle/目录下,这们就省的翻墙了。

    init.gradle 文件内容如下:

    allprojects {
        repositories {
            maven {
                url 'https://maven.aliyun.com/repository/public/'
            }
            maven {
                url 'https://maven.aliyun.com/repository/google/'
            }
    
            all { ArtifactRepository repo ->
                if (repo instanceof MavenArtifactRepository) {
                    def url = repo.url.toString()
    
                    if (url.startsWith('https://repo.maven.apache.org/maven2/') || url.startsWith('https://repo.maven.org/maven2') 
                        || url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')
                        || url.startsWith('https://maven.google.com/') || url.startsWith('https://dl.google.com/dl/android/maven2/')) {
                        //project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."
                        remove repo
                    }
                }
            }
        }
    
        buildscript {
            repositories {
                maven{ url 'https://maven.aliyun.com/repository/public/'}
                maven{ url 'https://maven.aliyun.com/repository/google/'}
    
                all { ArtifactRepository repo ->
                    if (repo instanceof MavenArtifactRepository) {
                        def url = repo.url.toString()
                        if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')
                             || url.startsWith('https://dl.google.com/dl/android/maven2/')) {
                            //project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."
                            remove repo
                        }
                    }
                }
            }
        }
    
    }
    

    全局翻墙代理配置

    同样新建一个gradle.properties 文件到$USER_HOME/.gradle/目录下,如果放在项目目录下,则只对当前项目生效。

    gradle.properties 文件内容如下:

    ## For more details on how to configure your build environment visit
    # http://www.gradle.org/docs/current/userguide/build_environment.html
    #
    # Specifies the JVM arguments used for the daemon process.
    # The setting is particularly useful for tweaking memory settings.
    # Default value: -Xmx1024m -XX:MaxPermSize=256m
    # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
    #
    # When configured, Gradle will run in incubating parallel mode.
    # This option should only be used with decoupled projects. More details, visit
    # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
    # org.gradle.parallel=true
    #Wed Apr 10 21:30:10 CST 2019
    systemProp.https.nonProxyHosts=127.0.0.1
    systemProp.http.proxyHost=127.0.0.1
    systemProp.https.proxyPort=8787
    systemProp.http.nonProxyHosts=127.0.0.1
    systemProp.https.proxyHost=127.0.0.1
    systemProp.http.proxyPort=8787
    
  • 相关阅读:
    实验四 决策树算法及应用
    实验三 朴素贝叶斯算法及应用
    实验二 K-近邻算法及应用
    实验一 感知器及其应用
    实验三 面向对象分析与设计
    实验二 结构化分析与设计
    实验一 软件开发文档与工具的安装与使用
    ATM管理系统
    活动图与流程图的区别与联系
    四则运算题目生成程序
  • 原文地址:https://www.cnblogs.com/flying_bat/p/11653373.html
Copyright © 2020-2023  润新知