Gradle Project Update Error in Android Studio 1.2.1.1

I created a sample project on a new installation of Android Studio v 1.2.1.1, and I came across this error message:

Gradle project refresh failed in Android Studio 1.2.1.1 

See image below:

enter image description here

So, I tried to find any solution on Google and I checked

gradle.properties file

Where:

 dependencies { classpath 'com.android.tools.build:gradle:1.2.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } 

After that, I tried updating all the SDK libraries using the SDK manager

And after that I tried to find the problem in the settings (see image)

But all without success. Because in the description of the error I don’t know anything that can be wrong and what needs to be fixed.

Any idea please?

Thanks so much for any help.

Note: Compiling using Cordova (which also uses Gradle) is no problem, and the application is compiled.

enter image description here

+3
android android-studio android-gradle build.gradle
Jun 11 '15 at 17:26
source share
7 answers

For those struggling with this error, here is my solution:

Step 1) Click “Android Studio” (top panel) → “Settings” → “Build, Run, Deploy” → “Build Tools” → “Gradle”

And select "Use local gradle distribution" and find the path for your gradle file (e.g. / Applications / Android Studio.app/Contents/ gradle / gradle-2.8)

Step 2) Click “File” (top panel) → “Project Structure” → Select “Application” in the “Modules” section. Then, make sure you install the compiler SDK version and build version.

Step 3) Open the project -> Open the file "build.gradle", and then delete the following lines:

 android { compileSdkVersion XX buildToolsVersion 'XX.XX' } 

Step 4) Click "Synchronize the project using the gradle Files button".

Full instructions here enter image description here

+6
Nov 24 '15 at 21:51
source share

This answer helped me solve my problem with gradle. stack overflow

Remove .gradle from the home directory.

+1
Jun 19 '15 at 8:29
source share

I tried several solutions for this. Finally, they worked after me.

  • Close Android Studio
  • Delete (or better move them somewhere to have a backup) .gradle from the following path:

Android Studio> File (menu bar)> Settings> Build, Run, Deploy> Build Tools> Gradle> (in the right pane) Service directory path: "Some Path" \ .gradle

Go to "Some Path" and delete or return the .gradle folder.

  1. Launch Android Studio again and rebuild / upgrade. This will again create the .gradle folder.

Greetings :)

+1
Dec 26 '15 at 19:00
source share

It may be too late to answer. But it can help someone.

In my case, there was a JDK path issue.

I just installed the correct JDK path for Android Studio 2.1

+1
May 22 '16 at 20:00
source share

Installing chmod on 775 in .gradle in the home directory helped me solve it.

0
Jun 15 '15 at 17:43
source share

File -> Invalidate Caches / Restart -> Invalidate and Restart for me.

0
Sep 26 '16 at 9:30
source share
 buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.0' } } allprojects { repositories { mavenCentral() } } 
0
Mar 12 '17 at 7:14
source share



All Articles