KFP
KFP

Reputation: 717

Could not execute build using gradle distribution 'http://services.gradle.org/distributions/gradle-1.9-all.zip'

I'm new to android development and I've downloaded Android SDK 4.2 and receiving the error:

Could not execute build using Gradle distribution 'http://services.gradle.org     /distributions/gradle-1.9-all.zip'. from the event log

I have tried many of the solutions here for similar error messages:

File - Invalidate Caches/restart - Invalidate and Restart. Then shutting down AS and renaming the .gradle folder in c/users/myname to old.gradle and restarting.

renaming the version number in build.gradle com.android.tools.build:gradle:0.7.+' to 0.8.+

renaming version in gradle-wrapper.properties services.gradle.org/distributions/gradle-1.9-all.zip to 1.10

uninstalling AS twice.

Some of the solutions I simple don't understand and for those that I do understand it seems I've tried them all.

I read to try another version of gradle 1.9, but don't where to begin. Are there versions like 1.9.1, 1.9.2..etc?

Any help?

build.gradle:

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

buildscript {
    repositories {
        mavenCentral()
     }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
    }
}

 allprojects {
    repositories {
        mavenCentral()
    }
}

gradle-wrapper.properties:

#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip

Upvotes: 5

Views: 12883

Answers (3)

Douglas Belton
Douglas Belton

Reputation: 11

I had the same problem as described at the top while following a course on Udemy. I was able to run my project on Android, but not Desktop. After messing around a lot, here is the solution that worked for me (n.b. I am a noob, so apologies for the simplicity of my answer:

with Project view (towards upper left, may be set to "Android":

go to gradle>wrapper>gradle-wrapper.properties and change the gradle distribution to "gradle-2.10-all.zip

then go to build.gradle and change "dependencies{classpath..." to "'com.android.tools.build:gradle:2.1.2'"

if you continue to get errors, you may need to return to the build.gradle and delete:

    jcenter()
    google()

near the top. Finally, ensure you are using the correct path for your assets by going to:

Launcher Options(where you select Android or Desktop deployment)>Edit Configurations

under working directory, set the path to android>assets

Hope this works for you

Upvotes: 1

voxoid
voxoid

Reputation: 1289

You may also get this error if you are experiencing Internet issues. (In my browser, some webpages worked, some didn't.) Resetting my modem resolved the gradle error for me.

Upvotes: 0

christoandrew
christoandrew

Reputation: 437

Had the same problem but what I did was

  1. To go to the Gradle Repo and download the zip file specified in the wrapper.
  2. Paste in the folder C:/User/youraccount/.gradle/wrapper/dist/weirdfoldername/
  3. open the android studio go to File > settings > gradle
  4. Make sure use default gradle wrapper is active and then check offline work
  5. Restart the studio

Worked for me. You should give it a try.

Upvotes: 0

Related Questions