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条回答
啃猪蹄的小仙女
2楼-- · 2019-01-21 04:08

It could be that you are using gradle in offline mode. To uncheck it go to File > Settings > Gradle, uncheck the Offline Work checkbox, and click Apply Make sure you have internet connection and sync the project again.

查看更多
做自己的国王
3楼-- · 2019-01-21 04:09

Just ignore the error and try running the project anyway. It will fail, but this time you will get a link in the error description. Clicking the link will trigger the automatic update/download of the outdated/missing component.

In my case, the project failed to launch two times, each time another API/SDK component being the culprit.

In my case I was just trying to launch a sample project I downloaded, having no clue what API level was being targeted or where to look for this information.

查看更多
够拽才男人
4楼-- · 2019-01-21 04:09

If your got timeout, Check Gradle Scripts -> gradle.properties in Android Studio, I found that I do have set a socket proxy in Android Studio settings, but in this gradle.properties file, my proxy became to http, so I just removed this http proxy setting lines, and finally works.

查看更多
对你真心纯属浪费
5楼-- · 2019-01-21 04:10

it looks different from one situation to another. for me i did an installation and update a lot of things that the sdk manager said to then i had this problem. all i did was: from file -> Invalidate caches/Restart (a dialog will pop-up) choose Invalidate and restart.

after the restart is done. everything was fixed but i needed to create a new emulator and delete the old one. (android studio 1.3.1) (one professional must edit this to be more understandable) . . . Here everything was fine, but your machines also needs restart because some system files are changed, to sync them we have to restart the system.

查看更多
叼着烟拽天下
6楼-- · 2019-01-21 04:12

Apparently, some platforms could be missing. This is how I solved the problem:

Do you see an error message that is shown at the bottom of your Android Studio window? It could be a smaller window on the bottom right also.., which looks like:

enter image description here

Now, Click on that blue link, do as the dialog boxes say (if any)...

That solved the problem. Hope it helps...

查看更多
何必那么认真
7楼-- · 2019-01-21 04:13

it was hard to solve but i did it look go to C:\Users(user name)

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

查看更多
登录 后发表回答