Gradle:Download https:// jcenter.bintray.com/ 下载缓慢解决方法

方案一:切换镜像仓库

原文地址
阿里的仓库地址(亲测有效):http://maven.aliyun.com/nexus/content/groups/public/
OSChina的仓库地址:http://maven.oschina.net/content/groups/public/

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

以上方法下载有时会下载不了,替换后如下:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
//        maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
//        maven()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

方案二:更换本地Gradle

原文地址
未经测试,自行查阅原文 O(∩_∩)O~~

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[1\]:这个错误是由于服务器返回了400错误,表示请求有误。可能是由于网络连接问题或者服务器端的错误导致的。建议你尝试启用Gradle的"offline mode"并同步项目,这样可以避免从服务器下载依赖。\[1\] 引用\[2\]:另外,你还可以检查一下你的Gradle工具是否与Gradle版本对应。你可以在Project Structure -> Project中查看Gradle版本,然后在build.gradle文件中修改classpath来匹配相应的Gradle插件版本。\[2\] 引用\[3\]:如果你遇到了"Could not find com.android.tools.build:gradle:7.4.0"这个错误,可以尝试以下解决思路: 1. 首先,不要直接使用File -> Open导入项目,而是使用File -> New -> Import Project来导入项目。 2. 检查你的Gradle配置,可以在Settings -> Build, Execution, Deployment -> Gradle中进行设置。 - 确保Gradle的home路径正确设置为你下载Gradle路径。 - 确保Gradle的JDK与项目的JDK版本一致。\[3\] #### 引用[.reference_title] - *1* [Android Studio报错Could not GET ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/](https://blog.csdn.net/qq_35341203/article/details/102788042)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [【坑】导入项目报错Could not find com.android.tools.build:gradle:7.4.0](https://blog.csdn.net/qq_56180303/article/details/129488968)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值