I just recently downloaded an Android Studio and installed it on my PC. But When I try to set up my first project \"hello world\", it always brings up the following:
<Guess what, I just faced this issue and I solved it.
I did something very risky, but it looks like the fault is in the gradle cache directory.
If you are using windows the dir. will be at C:\Users\username.....gradle\caches and deamon <- will be the directory where all the gradle versions are stored. Delete the latest particular version from the Cache as well as the Deamon folder. Next time your project syncs, AS will automatically generate the two files.
Also
3.Now go to android studio - File ->invalidate Cache/Restart 4.Now edit gradle-wrapper.properties and add latest version of gradle there.After updation my gradle-wrapper.properties looked like this. From the above answer. This worked for me
If any of the cases mentioned here didn't meet the expectations, there may be something wrong with your dnsapi.dll
file in your windows which several software use (It happens in rare cases but give it a try).
Close Android Studio and try running a program(software) that uses this dnsapi.dll
file. For ex. try running BitTorrent. If it says 'DNSapi.dll missing from your computer'
, then the studio error is most probably because of the corrupted/missing dll file.
Try running following command on your command prompt.(Make sure you have a good internet connection)
DISM.exe /Online /Cleanup-image /Restorehealth
And then run the system file checker.
sfc /scannow
It would take some time. Now run Android studio.
I solved the problem by doing the following:
C:/Users/.../.gradle/daemon/
daemon
registry.bin.lock
Success
First Credit Goes to Kali Kimanzi .. for this answer [Windows 7-10]
go to C:/Users/.../.gradle/daemon/ open any of the folders in daemon look for this file registry.bin.lock delete it now go sync the gradle in Android Studio and your problem should be solved
A little update for noobs .. C:/Users//.gradle/daemon/ and instead of deleting the file registry.bin.lock just rename it to registry.bin.lock.backup just incase .. though the file itself might be corrupt
I was facing the same problem in Android Studio 3.However, none of the solutions mentioned here worked for me.With only 4 GB of RAM available ,the only thing worked for me was just changing the value specified for JVM args which is related to RAM in gradle.properties file like the following:
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
to:
org.gradle.jvmargs=-Xmx512m
then File | Invalidate Caches/Restart--> Invalidate and Restart
This really did the trick.
I just followed the other answer but I couldn't find the registry.bin.lock file in mac, then I just deleted the following folders,'
/Users/../.gradle/caches
/Users/../.gradle/daemon
then do a File-> Invalidate Caches/Restart. The above folders should be updated during Gradle Sync, just say yes if it throws popup for gradle update
Please take a backup of these folders before deleting.