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!

ZaidRehman
  • 1,631
  • 2
  • 19
  • 30
Dashboarrd
  • 169
  • 1
  • 2
  • 11

7 Answers7

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

Hamit
  • 906
  • 6
  • 6
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.

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.

Amrit Pal Singh
  • 7,116
  • 7
  • 40
  • 50
0

I had faced similar kind of problem earlier!

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

Ziaridoy20
  • 29
  • 1
  • 3
0

Invalidate dependency cache by running

gradle clean build --refresh-dependencies

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

mushfek0001
  • 3,845
  • 1
  • 21
  • 20
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

Community
  • 1
  • 1
Naveen raj
  • 891
  • 1
  • 10
  • 18
0

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

arun-r
  • 3,104
  • 2
  • 22
  • 20