android studio 新项目一直卡在gradle插件下载中...

本文介绍了解决Gradle插件下载缓慢的方法,通过更换依赖仓库为阿里云镜像地址,有效提升下载速度,确保项目顺利进行。

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

项目一直卡在gradle插件下载中

1. 查看项目的gradle版本和插件版本是否对应

官网版本对应介绍

2. 替换仓库地址为镜像地址

参考

阿里云公共代理库
https://www.jianshu.com/p/ab1f5e5f5f5c

修改前的依赖

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镜像仓库地址

https://maven.aliyun.com/repository/jcenter

google镜像仓库地址

https://maven.aliyun.com/repository/google

完整模式

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

allprojects {
    repositories {
//        mavenCentral()
//        jcenter()
//        google()
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'https://maven.aliyun.com/repository/jcenter'}

    }
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值