5

When I started up my project this morning it randomly gave me a message saying Gradle project sync failed. Basic Functionality(eg. editing, debugging) will not work properly. in Android Studio. I looked at other answers that people had put up for this problem but they haven't been working. I invalidated my chaches/restarted my project but no luck. I also deleted my .gradle folder from my project folder and still no luck. If any of you guys could help me that would be awesome! This didn't happen yesterday when I was working on the project or anything, I wonder why its happening now. Oh yea it also says this as a gradle message: Error:C:\Users\Dave\.gradle\caches\2.2.1\scripts\settings_ad4t0wp5ikihzl1y1o83b5sbw\SettingsScript\buildscript\cache.properties (The system cannot find the file specified) :

Thanks again for anyone who reads this/ can help!

3
  • Hard to say, but what if you try to delete the gradle folder in your userprofile (C:\Users\Dave\.gradle), and then launch gradlew from your AS console (Alt+F12)? Commented Apr 5, 2015 at 16:51
  • I deleted my Gradle folder from (C:/Users/Dave/.gradle) just now, but how do I launch the gradlew? thanks! Commented Apr 5, 2015 at 17:14
  • open your project, find gradlew and launch it Commented Apr 5, 2015 at 17:18

7 Answers 7

3

There is a file - "cache.properties" that gradle creates for you, upon first time inception of any project. The path for this file is "~Home_Directory\.gradle\2.2.1\taskArtifacts". You may find this path in your home directory. So basically, this file - "cache.properties" is missing from the "taskArtifacts" folder.

One of the solution that worked for me is to copy file - "cache.properties" from any test project of yours to this project that's currently experiencing an issue.

Regards

Sign up to request clarification or add additional context in comments.

Comments

2

I had to choose using the Default Gradle Wrapper instead of local. << SETTINGS -->/ BUILD TOOLS --> Gradle --> radio button switch... >>

It has helped me to fix the same problem.

Comments

1

I had experience similar sync failed problem with gradle based android project (in Android Studio 1.1.0). I solved this problem without deleting .gradle from my user directory, steps I followed was

  1. Go to File -> Settings -> Compiler(Gradle Based Android Project)

  2. Change VM options to -Xmx512m -XX:MaxPermSize=512m.

  3. Click Apply -> OK and then tap on Try Again option in sync failed message to clean build the project.

Works like charm!!

UPDATE - 1 : For Android Studio 1.3, Compiler option mentioned in above Step-1 is present inside tab Build, Execution, Deployment.

2 Comments

I use Android Studio 1.3 and there isn't any VM options in Compiler.
In Compiler setting, I tick Sync project with Gradle before building and it's worked.
0

I had faced similar kind of problem earlier!

But don`t know after rebuild the project and cleaning it, it worked normally.

Comments

0

Invalidate dependency cache by running

gradle clean build --refresh-dependencies 

from project root and then re-import your project. Worked for me once.

1 Comment

Im knew to this kind of thing. How do I get to my project root? thank you!
0

May be you have put Android Studio into offline mode. To fix it, go to Preferences -> Gradle and ensure that the "Offline work" checkbox is not checked.

Than do

  1. File -> Invalidate caches / Restart
  2. Shutdown Android Studio
  3. Rename/remove .gradle folder in the user home directory
  4. Restart Android Studio let it download all the Gradle stuff it needs

android studio 0.4.2: Gradle project sync failed error

Comments

0

Delete the folder C:\Users\.gradle and reopening the android studio solved my problem

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.