[android] Android Studio - Gradle sync project failed

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

This question is related to android gradle android-gradle-plugin

The answer is


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


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.


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.


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.


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


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" }
}

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.


In my case NDK location was the issue.

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


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


Use this line to your Build gradle app

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

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

good luck!


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.


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.


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


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


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to gradle

Gradle - Move a folder from ABC to XYZ A failure occurred while executing com.android.build.gradle.internal.tasks Gradle: Could not determine java version from '11.0.2' Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 Failed to resolve: com.android.support:appcompat-v7:28.0 Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries java.lang.NoClassDefFoundError:failed resolution of :Lorg/apache/http/ProtocolVersion Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0)

Examples related to android-gradle-plugin

WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Android Material and appcompat Manifest merger failed Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve Failed to resolve: com.google.firebase:firebase-core:16.0.1 com.google.android.gms:play-services-measurement-base is being requested by various other libraries Invoke-customs are only supported starting with android 0 --min-api 26 error: resource android:attr/fontVariationSettings not found Exception : AAPT2 error: check logs for details Could not resolve com.android.support:appcompat-v7:26.1.0 in Android Studio new project Failed to resolve: com.android.support:appcompat-v7:27.+ (Dependency Error)