Error running android: Gradle project sync failed.

2019-01-21 03:38发布

Android Studio (1.2 RC0) keeps telling me Error running android: Gradle project sync failed. Please fix your project and try again. How can I find out what the problem is? Unfortunately the solutions from this SO thread did not help.

21条回答
你好瞎i
2楼-- · 2019-01-21 04:20

Goto File -> Invalidate caches / Restart Shutdown Android Studio Rename/remove .gradle folder in the user home directory Restart Android Studio (It will download gradle metadata and data) Gradle build succeed Rebuild project. Done

查看更多
一纸荒年 Trace。
3楼-- · 2019-01-21 04:20

I ran into the same issue, but then did the following, and my issue was resolved:

  • updated Gradle
  • installed the latest version of Android studio (mine was out of date)

And that solved my problem.

Note: It also helped me to click on the event log, because it has more detailed info about errors. https://developer.android.com/studio/releases/gradle-plugin#updating-plugin also has great info.

查看更多
看我几分像从前
4楼-- · 2019-01-21 04:22

Its because the gradle is not synced because of many reasons.

Go to project folder and remove .gradle folder and start sync. It will work

查看更多
Rolldiameter
5楼-- · 2019-01-21 04:23

Go to

file->settings->build,execution,deployment->gradle.

(and set gradle home path from your directory)

查看更多
SAY GOODBYE
6楼-- · 2019-01-21 04:27

It is a very common issue and the solution is very easy... Just update the SDK in SDK manager(see full instructions below)

  1. Open Android Studio and go to your SDK Manager(File>Settings>SDK Manager)
  2. Check for (-) icon in front of any package and click on it.
  3. Click OK to start updating the SDK.

Thanks for asking that question :)

查看更多
疯言疯语
7楼-- · 2019-01-21 04:28
  1. Download the latest Gradle package distribution for example (gradle-2.11-all.zip).
  2. Extract this zip file in a folder as for example (D://Gradle)
  3. Load your project in Android Studio and go to File->Settings->Gradle. Click on Use local Gradle distribution and point it to the folder where you unzipped the latest Gradle project.
  4. Restart your project
查看更多
登录 后发表回答