There are mainly 2 solutions,you can use any of them:


[Android Studio]


Solution 1:




1. delete gradle and .gradle folders from your project folder.

2. in Android Studio: open your project then: File -> settings -> compiler -> gradle: enable offline mode.

3. close your project: File -> close project.

4. connect to Internet and open your project again then let Android Studio downloads what it wants.

If encounter gradle project sync failed again please follow these steps:

6.download gradle 1.10 form here.

7. extract it and put it somewhere(for example f:\gradle-1.10).

8. go to your Android Studio and load your project then open File->Settings->gradle, in this page click on Use local gradle distribution
9. type your gradle folder address there.

Congratulation you are done!


Solution 2:



Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.


On Windows, please go to:

Control Panel > System > Advanced(tab) > Environment Variables > System Variables > New

Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M

Save it, restart AS.