Kavir
Kavir

Reputation: 246

Error:Could not run build action using Gradle installation (gradle 2.4 ,android studio)

I just update Android Studio and I can't build any project, even newly created ones.

The error I got is:

Error:Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.4.zip'.

what should I do?

Upvotes: 19

Views: 145811

Answers (6)

Peter Kelley
Peter Kelley

Reputation: 4196

Don't forget to check to obvious stuff first!

I know this is a very old question, and it has a good accepted answer (and other good ones too!) but this was my issue today with this and I'm happy to say in this case it was the simple fix.
In Eclipse - the Error msg showed in Problems tab in Eclipse "Could not run phased build action using connection to Gradle distribution 'https:...' "
Looked in the Console tab for message, in my case it was

Could not get unknown property 'blabblah' for root project...

The problem was that I had removed a property from my gradle.properties file and hadn't checked that it was no longer used. I was distracted by the Problems tab message and googled that instead of looking at the console. Wasted more minutes than I care to admit.

Check the obvious stuff first! (like the console messages!)

Upvotes: 0

rghome
rghome

Reputation: 8819

I had this error using Eclipse and Buildship. None of the other fixes worked. The problem turned out to be in my Eclipse preferences. I believe it was a mismatch between the workspace JDK and/or Gradle home and the ones in the Gradle config. The following steps fixed the problem:

  • Set the Java JRE to the JDK specified in the Gradle configuration (Preferences -> Java -> Installed JREs)
  • Set the Java JRE and the Gradle home in the Eclipse Gradle config (Preferences -> Gradle).

Then refresh the Gradle project (Project -> Gradle -> Refresh Gradle Project).

Upvotes: 1

Kingsley Ijike
Kingsley Ijike

Reputation: 1399

I got the same error while trying to import a Gradle project on Eclipse. It turned out that Eclipse was not able to access a particular hidden folder (jars-3) in username/gradle/caches/jars-3. I tried modifying it myself, but even as an administrator, I could not.

I had to use the steps in this article to resolve the problem.

Open an elevated command prompt, and enter the following, replacing"FULL_PATH" with the affected folder.

 TAKEOWN /F X:\FULL_PATH_HERE
 TAKEOWN /F X:\FULL_PATH_HERE /r /d y
 icacls X:\FULL_PATH_HERE /grant Administrators:F 
 icacls X:\FULL_PATH_HERE /grant Administrators:F /t

Finally, close the Command Prompt and try changing the permissions for the folder. After that, delete the imported project and reimport it. It worked fine for me.

Upvotes: 1

ℛɑƒæĿᴿᴹᴿ
ℛɑƒæĿᴿᴹᴿ

Reputation: 5326

In Eclipse, for me it resolved as follows:

  • Delete:

    • workspace/yourProject/.gradle (folder)
  • In Eclipse:

    • Right click on ProjectName > Gradle > Refresh Gradle Project

enter image description here

  • Wait:

    • Download all dependencies
  • Done!

Upvotes: 9

MajidAbdullahi
MajidAbdullahi

Reputation: 268

We have two famous way for this problem:

1- update the gradle:

step 1:

Get latest version supported by Android Studio from:

https://services.gradle.org/distributions

step 2:

Extract the gradle file and install to dists folder(gradle folder): default location is: C:\Users[username]\gradle\wrapper\dists

step 3:

Open Android Studio: File/Settings/Gradle/Service directory path: (Change to folder you set above) and Click ok.

Status on bottom should indicate it's busy & error should be fixed.

step 4:

restart Android Studio

2- Delete the .gradle folder:

default location is:

C:\Users[username]\gradle\wrapper\dists

after that open Android Studio and make a new project (might need to reastart).

Upvotes: 13

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363439

The link you are using is wrong.

Use:

https://services.gradle.org/distributions/gradle-2.4-all.zip

Check the gradle/wrapper/gradle-wrapper.properties file:

distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

Upvotes: 5

Related Questions