Android Studio can never download fastutil-7.2.0.jar

Viewed 2632

Similar question: Android studio gradle stuck at Fastutil.7.2.0.jar

When I'm building my first Android App in Java, Android Studio 4.0 is always complaining:

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

However, it's possible to download the jar with the browser.

If I remove jcenter()in build.gradle, a similar error occurs:

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

This file doesn't even exist.

I tried modifying build.gradle or setting up proxy, but neither works.

gradle.build file:

// 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
}

UPDATE:

Solved. Proxy's fault. Check C:\Users\USERNAME\.gradle\gradle.properties.

1 Answers

Make sure you have installed Command line tools

if not install from sdk manager > sdk tools > check command line tools and apply

Related