美文网首页
Android studio 无法下载库的问题

Android studio 无法下载库的问题

作者: 不问何处有明月 | 来源:发表于2018-12-19 16:53 被阅读0次

    有时 as 载入库时特别慢,有时还失败。

    我们可以用阿里云代理。

    在电脑目录:C:\Users\用户名.gradle 目录下,创建 init.gradle.txt 文件。

    输入:

    allprojects{ 
        repositories { 
            def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/' 
            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/')) { 
                    project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL." 
                    remove repo 
              } 
        } 
    } 
    maven { 
        url REPOSITORY_URL 
    } 
    } 
    }
    

    这时就可以用阿里云代理 下载了。

    相关文章

      网友评论

          本文标题:Android studio 无法下载库的问题

          本文链接:https://www.haomeiwen.com/subject/xdgjkqtx.html