Gradle Build Running in Android Studio for too long

17,453

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.

Share:
17,453
Abhishek
Author by

Abhishek

Updated on July 26, 2022

Comments

  • Abhishek
    Abhishek almost 2 years

    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.

  • abhig10
    abhig10 about 8 years
    Only stopping the gradle execution from terminal didn't put an end to the process for me. I had to go all the way to .\Android_Studio\gradle\gradle-2.10\bin from command line and stop the gradle using gradle --stop