zoukankan      html  css  js  c++  java
  • 完美解决gradle依赖库导致build慢的问题

    https://www.jianshu.com/p/ab1f5e5f5f5c

    我们的目标就是:让天下没有困难的编程

    首先,我们来看看google官方的依赖方式:

    buildscript {
        repositories {
            mavenCentral()
            jcenter()
            google()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1'
        }
    }
    
    allprojects {
        repositories {
            mavenCentral()
            jcenter()
            google()
        }
    }
    

    上面的这种方式,由于会用到google的maven仓库,直接导致相关的依赖库无法下载,gradle plug3.0无法下载的问题。

    那我们的解决方式就是使用阿里云的国内镜像,你有飞一般的感觉。

    mavenCentral镜像仓库地址

    http://maven.aliyun.com/nexus/content/groups/public/
    

    jentral镜像仓库地址

    http://maven.aliyun.com/nexus/content/repositories/jcenter
    

    google镜像仓库地址

    http://maven.aliyun.com/nexus/content/repositories/google
    

    我们更新工程的build.gradle成如下形式

    buildscript {
        repositories {
    //        mavenCentral()
    //        jcenter()
    //        google()
            maven { url 'https://plugins.gradle.org/m2/' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
            maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.1'
        }
    }
    
    allprojects {
        repositories {
    //        mavenCentral()
    //        jcenter()
    //        google()
            maven { url 'https://plugins.gradle.org/m2/' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
            maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
        }
    }
    

    别忘了关注我们的公众号



    作者:康熙微博私访记
    链接:https://www.jianshu.com/p/ab1f5e5f5f5c
    来源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
  • 相关阅读:
    洛谷1462 通往奥格瑞玛的道路 二分+spfa
    NumPy 排序、条件刷选函数
    NumPy 统计函数
    2019-3-10——生成对抗网络GAN---生成mnist手写数字图像
    python if __name__ == 'main' 的作用和原理()
    Python os.getcwd()
    numpy.random.uniform()
    tf.trainable_variables()
    tf.layers.dense()
    彻底弄懂tf.Variable、tf.get_variable、tf.variable_scope以及tf.name_scope异同
  • 原文地址:https://www.cnblogs.com/sundaysandroid/p/13495008.html
Copyright © 2011-2022 走看看