29

In Android Studio, I simply created a new project, and it says that:

Gradle project sync failed. Basic functionality will not work properly.

I have searched the web and tried everything, but nothing worked. I have v0.4.6 of Android Studio using Gradle 1.11.

The Error Message Is:

FAILURE: Build failed with an exception.

* Where:                    
Build file 'C:\Users\Vinnie\AndroidStudioProjects\MyFirstAppProject\MyFirstApp\build.gradle' line: 9

* What went wrong:          
A problem occurred evaluating project ':MyFirstApp'.
> Gradle version 1.10 is required. Current version is 1.11. If using the gradle wrapper, try editing the distributionUrl in C:\Users\Vinnie\AndroidStudioProjects\MyFirstAppProject\MyFirstApp\gradle\wrapper\gradle-wrapper.properties to gradle-1.10-all.zip

* Try:                      
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED                

Total time: 1 mins 7.011 secs
vcapra1
  • 1,988
  • 3
  • 26
  • 45

17 Answers17

20

The Android plugin 0.8.x doesn't support Gradle 1.11, you need to use 1.10.

You can read the proper error message in the "Gradle Console" tab.

EDIT

You need to change gradle/wrapper/gradle-wrapper.properties file in this way:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
rciovati
  • 27,603
  • 6
  • 82
  • 101
  • I uninstalled Gradle 1.11 and installed 1.10, changed my PATH variable, and everything, and still get the same error message – vcapra1 Mar 03 '14 at 15:06
  • Try compile it from shell and report the full error. – rciovati Mar 03 '14 at 15:07
  • When I run gradle command, it says BUILD SUCCESSFUL, however when I try to run the project, it says `Error running MyFirstApp: Gradle project sync failed. Pass fix your project and try again` – vcapra1 Mar 03 '14 at 15:20
  • However, when I run `gradlew`, is Failed. I will post the error message in my question – vcapra1 Mar 03 '14 at 15:21
  • How is your android project setup? I mean is using the gradle wrapper as it should? then the answer is completle correct and you have no need to install gradle, it's done by the wrapper when needed. – Rene M. Mar 03 '14 at 19:17
  • I got this issue resolved by deleting my project from disk and importing it again. Not sure what went wrong but the logs showed that android studio was working with JDK 1.6 while I had 1.7 installed on my box. Also, neither restarting the system or android studio helped me with this issue. – tranquil Feb 23 '15 at 12:32
  • Half of the life spent on building Gradle – Eshan Chattaraj Jun 13 '18 at 06:32
10

This may be helpful for some.

My problem exactly is incomplete gradle-1.12-all file download.

Below is screen shot of the Error

enter image description here

  1. I re-downloaded the file from the gradle site here and extracted it in path/to/the/gradle, in my case was in C:\Users\maneeOsman\.gradle\wrapper\dists\gradle-1.12-all\2apkk7d25miauqf1pdjp1bm0uo
  2. I closed the android studio and reopen it in administrator privilege (Run as administrator).

The android studio starts downloading the necessary files for building and debugging. You can notice that from bottom-left indicator bar.

After this, it is working fine.

See the screen shot below

enter image description here

timekeeper
  • 698
  • 15
  • 37
Manee.O.H
  • 589
  • 8
  • 19
10

In my case NDK location was the issue.

go to File->Project Structure->SDK Location and add NDK location

Cerlin
  • 6,622
  • 1
  • 20
  • 28
5

Here is the solution I found: On the project tree "app", right click mouse button to get the context menu. Select "open module setting", on the tree "app" - "properties" tab, select the existing "build tools version" you have. The gradle will start to build.

StevenZ
  • 141
  • 1
  • 9
3

I have encountered this problem And I solved it as follows: File->Sync Project with Gradle Files

good luck!

hungtam
  • 31
  • 2
2

After applying this fix that was found here... https://code.google.com/p/android/issues/detail?id=208295

in file $SDK/ndk_bundle/source.properties replace "12.0.2753695 beta 1" to "12.0.2753695-beta1"

My project was built successfully and ran on device and emulators although 5 warnings still remains.

2

Remove the dependency "junit:junit:4.12" from app modules...!!! This solution is for gradle to sync all files.

Snag
  • 21
  • 1
2

it was hard to solve but i did it look go to C:\Users\Vinnie\ delete .gradle file its you didn't see it it may be in hidden files so if you use windows 7 right click then click on properties and click on hidden to be not checked

then the file will appear then delete it i hope this works

Zeyad Asem
  • 29
  • 3
  • I deleted .gradle inside androidStudio project, and that helped. I didn't delete the .gradle in c:\users\me – arberg Feb 25 '20 at 15:09
1

I know this is an old thread but I ended up here with the same issue.

I solved it by comparing the dependencies classpath in the build.gradle script(Project) to the installed version.

The error message was pointing to the following folder

C:\Program Files\Android\android-studio3 preview\gradle\m2repository\com\android\tools\build\gradle

It turned out that the alpha2 version was installed but the classpath was still pointing to alpaha1. A simple change to the classpath ('com.android.tools.build:gradle:3.0.0-alpha2') was all that was needed.

This may not help everyone, but I do hope it help most people out.

Stuey
  • 48
  • 7
1

I was behind firewall|proxy.

In my case with Studio, ERROR: Gradle sync failed & Cannot find symbol. I have used

repositories {
           jcenter();  // Points to HTTPS://jcenter.bintray.com
}

Replace it with http and maven

repositories {
        maven { url "http://jcenter.bintray.com" }
}
Ravi Parekh
  • 5,253
  • 9
  • 46
  • 58
1

i had same issue i solved by changing gradle plugin version and and gradle version

see image for more refrence

Sambhav jain
  • 1,467
  • 12
  • 19
0

Use this line to your Build gradle app

repositories {
    maven { url "http://jcenter.bintray.com" }}
0

Using an outdated gradle version may also result to fail in synchronization. Download latest version from https://gradle.org/releases/ and download the "complete" latest version. Now replace it with the outdated version which is located C:\Program Files\Android\Android Studio\gradle. Go to settings(ctrl+alt+s) ,go to gradle and add the the new gradle directory in "use local gradle distribution" "Gradle home:C:\Program Files\Android\Android Studio\gradle\gradle4.4.1 ."

It Worked for me. Hope u understand.

0

Update for 2018:

I have faced this issue recently and it was resolved by updating android studio & updating gradle when prompted then rebuilding the project

Ahmed Elkoussy
  • 8,162
  • 10
  • 60
  • 85
0

I had a "Install build tools and sync" link in the lower right hand corner of my screen. I clicked on that and it fixed the issue.

user348731
  • 33
  • 6
0

Each version of the Android Gradle Plugin now has a default version of the build tools. For the best performance, you should use the latest possible version of both Gradle and the plugin. You recive this warning in case if you use latest gradle plugin but not use latest SDK version. For example for Gradle plugin 3.2.0 (September 2018) you requires Gradle 4.6 or higher and SDK Build Tools 28.0.3 or higher.

Although you typically don't need to specify the build tools version, when using Android Gradle plugin 3.2.0 with renderscriptSupportModeEnabled set to true, you need to include the following in each module's build.gradle file: android.buildToolsVersion "28.0.3"

see more https://developer.android.com/studio/releases/gradle-plugin

Oleg Ushakov
  • 1,200
  • 14
  • 27
0

Update gradle to the latest available version and implement libraries to the latest version available, also check if google play services is latest if used.

Athira
  • 1,177
  • 3
  • 13
  • 35