I\'m new to Gradle build system. I want to do some basic functions on it. I\'m running/building it in command line. I am referring User guide. And, doing some simple tasks.<
I could be late but look like quick and efficient solution.
Execute following steps.
ps -ef | grep gradle
find ~/.gradle -type f -name "*.lock" | while read f; do rm $f; done
It's done.
I had same problem and i did two steps and it became solved.
To resolve this problem in windows
Have tried all this answers, including kill java process, delete .gradle in HOME_DIR and in project dir, restarted Android Studio, and even restarted OS.
It started to work normally only after I launched gradle sync.
In my case, just closed the Android Studio and reopened it, the problem solved.
While killing the process and/or removing the lock file works, Gradle should be able to handle this on its own, solving the problem permanently. This problem report hints at the solution: Gradle cannot communicate with the gradle service.
Have a look at your local network firewall. In my case,
allowing outbound traffic from 127.0.0.1 to 127.0.0.1,
sudo iptables -A OUTPUT -p udp -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
allowing incoming traffic from 127.0.0.1
sudo iptables -A INPUT -s 127.0.0.1 -p udp -j ACCEPT
solved the issue. A discussion of a similar problem at github.
And, Please refer any link to improve my knowledge on Gradle Build system in Android.
The udacity gradle course, if you have some time.