前言

新建或者导入Android Studio工程,由于各种原因,Gradle下载慢或者更本无法下载,因此需要替换为国内的代理。

记录于此,方便自己查阅。

正文

解决方法:

使用阿里仓库服务替换,更多内容可以访问这个:https://maven.aliyun.com/mvn/view

具体操作:

将build.gradle中google()和jcenter()注释掉,替换为以下代码:

google{ url 'https://maven.aliyun.com/repository/google'}
jcenter{ url 'https://maven.aliyun.com/repository/jcenter'}

有时候google()不需要替换,按自己需求吧。

google()
jcenter{ url 'https://maven.aliyun.com/repository/jcenter'}

显示我项目中经常用的

    repositories {
        maven {url 'https://maven.aliyun.com/repository/central'}
        maven {url 'https://maven.aliyun.com/repository/jcenter'}
        maven {url 'https://maven.aliyun.com/repository/google'}
        mavenCentral()
        google()
    }

参考文章

  1. https://tieba.baidu.com/p/6495628682
  2. 参考公司项目配置

相关文章

暂无评论

none
暂无评论...