Dashboarrd
Dashboarrd

Reputation: 169

Gradle project sync failed?

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!

Upvotes: 5

Views: 11778

Answers (7)

arun-r
arun-r

Reputation: 3381

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

Upvotes: 0

Pavel Gluzman
Pavel Gluzman

Reputation: 21

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.

Upvotes: 2

Amrit Pal Singh
Amrit Pal Singh

Reputation: 7132

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.

Upvotes: 1

Hamit
Hamit

Reputation: 916

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

Upvotes: 3

Naveen raj
Naveen raj

Reputation: 931

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

Upvotes: 0

mushfek0001
mushfek0001

Reputation: 3935

Invalidate dependency cache by running

gradle clean build --refresh-dependencies

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

Upvotes: 0

Ziaridoy20
Ziaridoy20

Reputation: 29

I had faced similar kind of problem earlier!

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

Upvotes: 0

Related Questions