Abhishek Abhishek - 10 months ago 57
Android Question

Gradle Build Running in Android Studio for too long

Whenever I Start or run my project the gradle build running never stops.I have tried creating new project nothing is happening. Some projects are working fine but some of them are not and taking forever in gradle build running. Also whenever I open the project this cmd appt.exe file opens.

Answer Source

Open the terminal tab and try building the project manually gradle --stop clean build --stacktrace

The --stop param will kill any running instances of the gradle daemon. Its also possible gradle ran into a .lock file that is blocking its execution. This can happen if a build is terminated before completion. When you run on the command line it may take as long as 3 minutes before gradle gives up and fails. The error message provided by --stacktrace should tell you where the file causing the problem is.

Just delete the lock file: rm <pathToLockFile> then rebuild. This could happen a few times before the build completes.

It would be nice if there was a way to clean up all locks but to my knowledge this doesn't exist.