当前位置:   article > 正文

Android studio 解决Gradle下载缓慢的问题_android studio gradle下载慢

android studio gradle下载慢

一、前言

第一次创建项目时AS会直接从默认的仓库下载,由于是国外服务器,下载非常慢,有时部分库还无法下载。所以我们需要将默认的仓库地址替换为国内的阿里云镜像地址,从而提升下载速度。

二、步骤

步骤一:
  打开【build.gradle】文件。
在这里插入图片描述
步骤二:
  将repositories标签中的内容替换成自己需要的阿里镜像maven仓库地址。
  阿里镜像maven仓库地址对应表请查看附录
在这里插入图片描述

    repositories {
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://jitpack.io' }
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

三、附录

仓库名称阿里云仓库地址源地址
centralhttps://maven.aliyun.com/repository/centralhttps://repo1.maven.org/maven2/
jcenterhttps://maven.aliyun.com/repository/jcenterhttp://jcenter.bintray.com/
publichttps://maven.aliyun.com/repository/publiccentral仓和jcenter仓的聚合仓
googlehttps://maven.aliyun.com/repository/googlehttps://maven.google.com/
gradle-pluginfhttps://maven.aliyun.com/repository/gradle-pluginhttps://plugins.gradle.org/m2/
springhttps://maven.aliyun.com/repository/springhttp://repo.spring.io/libs-milestone/
spring-pluginhttps://maven.aliyun.com/repository/spring-pluginhttp://repo.spring.io/plugins-release/
grails-corehttps://maven.aliyun.com/repository/grails-corehttps://repo.grails.org/grails/core
apache snapshotshttps://maven.aliyun.com/repository/apache-snapshotshttps://repository.apache.org/snapshots/
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/287819?site
推荐阅读
相关标签
  

闽ICP备14008679号