Android Studio - Gradle sync project failed

2019-01-17 20:39发布

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

16条回答
我想做一个坏孩纸
2楼-- · 2019-01-17 20:45

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

查看更多
聊天终结者
3楼-- · 2019-01-17 20:46

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

good luck!

查看更多
ら.Afraid
4楼-- · 2019-01-17 20:46

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.

查看更多
Rolldiameter
5楼-- · 2019-01-17 20:47

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
查看更多
我命由我不由天
6楼-- · 2019-01-17 20:47

In my case NDK location was the issue.

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

查看更多
Lonely孤独者°
7楼-- · 2019-01-17 20:50

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.

查看更多
登录 后发表回答