zoukankan      html  css  js  c++  java
  • 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
    
  • 相关阅读:
    eclipse注释模板__自动生成方法注释
    java HashMap--统计其中有相同value的key的个数
    java synchronized 详解
    进程间通信-共享内存
    辅导-计算机编程方面
    gnu make
    适应c++ 新特性
    tomcat服务器
    springmvc笔记
    Idea使用SVN教程
  • 原文地址:https://www.cnblogs.com/flying_bat/p/11653373.html
Copyright © 2011-2022 走看看