Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle downloads "builder-3.1.2.jar" forever

Hello I really need your help.

I'm using Android Studio 3.1.2 and I'm new at Android app developpement.

So, I get some issues with Gradle. When I create a new project, the Gradle build starts but downloads take FOREVER. It has been now 3 hours that I'm waiting for the download to finish.

When I copy/paste the download file (https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.1.2/builder-3.1.2.jar) in my browser, It took only 30 seconds. I tried everything and searched all stackoverflow but I found nothing :(

Thank you

UPDATE Here are my two files as asked.

My project build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.bg.selim.reminder"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

My gradle.properties file:

# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

build.gradle file from project root folder

// 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:3.1.2'


        // 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
}
like image 1000
selimgrr Avatar asked Nov 29 '25 15:11

selimgrr


2 Answers

If you still have trouble, you can try to download the builder-3.1.2.jar and its builder-3.1.2.pom file, and put them into your Android Studio folder under:

AndroidStudio > gradle > m2repository > com > android > tools > build > builder > 3.1.2 

Put builder-3.1.2.jar and builder-3.1.2.pom under the folder 3.1.2 and you should be good to go.

like image 181
xiaomi Avatar answered Dec 02 '25 03:12

xiaomi


Disconnecting with jcenter https can also lead this problem.
And in this case it will show this message:

Could not find builder.jar (com.android.tools.build:builder:3.1.2).
Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/build/builder/3.1.2/builder-3.1.2.jar

Then I replace the jcenter () in the gradle repositories block with

jcenter {
   url "http://jcenter.bintray.com/"
}

Notice the http instead of https.

Then it compiles successfully.
Hope this could be helpful.

like image 40
Crow Avatar answered Dec 02 '25 05:12

Crow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!