3

类似问题:Android studio gradle 卡在 Fastutil.7.2.0.jar

当我用 Java 构建我的第一个 Android 应用程序时,Android Studio 4.0 总是抱怨:

Could not GET 'https://jcenter.bintray.com/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.jar'. Received status code 400 from server: Bad Request
Enable Gradle 'offline mode' and sync project

但是,可以jar使用浏览器下载。

如果我删除jcenter()in build.gradle,则会发生类似的错误:

Could not HEAD 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.72/kotlin-stdlib-jdk8-1.3.72.pom'. Received status code 400 from server: Bad Request
Enable Gradle 'offline mode' and sync project

这个文件甚至不存在。

我尝试修改build.gradle或设置代理,但都不起作用。

gradle.build文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

更新:

解决了。代理的错。检查C:\Users\USERNAME\.gradle\gradle.properties

4

1 回答 1

0

确保您已安装命令行工具

如果不是从 sdk manager > sdk tools > 检查命令行工具并应用

于 2022-01-23T19:05:56.340 回答