Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gradle sync failed on intellij idea 13.1.1

I'm creating an Android project with Gradle Android Module, but as soon as I create it, I have an error I don't understand and I have no idea to resolve it. It says

Gradle project sync failed. Basic functionality (e.g editing, debugging) will not work properly" or "Gradle 'myapp' project refresh failed: A fatal exception has occurred. Program will exit. : Gradle settings

If you have an idea of what causes this problem or if you have already encountered it, please tell me what to do.

like image 218
user3441190 Avatar asked Apr 02 '14 08:04

user3441190


People also ask

Why is my Gradle sync failing?

In some cases when your Gradle files are deleted or corrupted you will not be able to download new Gradle files in android studio. In this case, we have to delete the Gradle files which are present already and then again sync your project to download our Gradle files again.

How do I sync Gradle project in IntelliJ?

If you have some custom plugins that require you to import your project from the IntelliJ IDEA model, press Ctrl+Shift+A and search for the Project from Existing Sources action. In the dialog that opens, select a directory containing a Gradle project and click OK. IntelliJ IDEA opens and syncs the project in the IDE.


2 Answers

Came across this issue when I was having similar issue. I solved this problem as follows

  1. Download and extract gradle file to directory of choice

  2. Set the environmental variable for gradle, I think this has no effect in the solution.

  3. Go to intellij and access setting window through File -> Setting

  4. On setting window, go to Build, Execute. Deployment -> Build Tools -> Gradle

  5. Check "Use local gradle distribution"

  6. From Gradle home field access gradle installed path

Please note, I am working with intellij 15.

like image 141
olatno Avatar answered Oct 11 '22 22:10

olatno


I have run into the same problem. Part of it may be that you have recently installed the Android SDK and have not accepted the license agreement. Here are the steps you can take. (I was using IntelliJ Ultimate IDEA 14.0.2.)

  1. Stop IntelliJ and restart it with Admin privileges. (You will be expanding zip files in the Program Files (x86) directory, and won't be able to do so unless you are an administrator).
  2. On the "messages Gradle Sync" (bottom window), there is a hyperlink that says Error: "Install Repository and sync project." Click on it.
  3. Accept the License Agreement.
like image 26
rajah9 Avatar answered Oct 11 '22 22:10

rajah9