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

本文介绍如何通过更换Android Studio项目的默认仓库地址为阿里云镜像地址来提高资源下载速度。主要步骤包括修改build.gradle文件中的repositories标签,用阿里云提供的maven仓库地址替代原有的国外服务器地址。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、前言

第一次创建项目时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' }
    }

三、附录

仓库名称阿里云仓库地址源地址
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/
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值