J Vasco Pinto
J Vasco Pinto

Reputation: 51

Android Studio Error: Could not install Gradle distribution from 'file:/C:/Users/~/gradle/wrapper/'

I'm a complete noob who needs some help on this. How do I correct this issue? Thanks a lot!! Where is it wrong?

My file

gradle-wrapper.properties

 #Fri Jul 19 12:04:39 BST 2019
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=
      https\://services.gradle.org/distributions/gradle-5.1.1-all.zip= 

build.gradle (module:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.example.a7700teste"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 5
        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'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:28.1.1'
    implementation 'com.android.support:design:28.1.1'
    implementation 'com.android.support:exifinterface:28.1.1'
    implementation 'com.android.support.constraint:constraint-layout:3.0.0'
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-auth:18.1.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'com.google.firebase:firebase-storage:18.1.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
}

    apply plugin: 'com.google.gms.google-services'

build.gradle (project)

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.3.0'
        classpath 'com.google.gms:google-services:4.3.0'
        implementation 'com.google.firebase:firebase-core:17.0.1'

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

allprojects {
    repositories {
        google()
        jcenter()
        /*maven {
            url: "https://maven.google.com"
        }*/
    }
}

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

When i try to make a Gradle Project Sync it fails, and says:

ERROR MESSAGE: Could not install Gradle distribution from 'file:/C:/Users/Admin/AndroidStudioProjects/7700teste/gradle/wrapper/'.

Upvotes: 5

Views: 22060

Answers (1)

Hussein Ahmed
Hussein Ahmed

Reputation: 750

From Android studio click "In windows"(Ctrl + Alt + s) OR from menu (File > Settings) will open Settings.

Build, Execution, Deployment > Build Tools > Gradle

set Gradle user home to .gradle path folder ex: C:/Users/YOUR_UN/.gradle

The current version is 7.0.2, so these the current auto configured files

gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

build.gradle

classpath "com.android.tools.build:gradle:7.0.2"

Upvotes: 12

Related Questions