How to Force Stop Android Studio Compilation

By | March 19, 2017

Android Studio’s interface doesn’t include a STOP button to cancel the compilation. If you have ever pressed the “Build & Run” button for a large project, you’ll know what I’m talking about. The pain is real.

For smaller projects, this isn’t really a big deal. They usually compile within a few seconds. If, however, you are working on a large project which takes more than a few minutes to compile, the compilation time can be a huge annoyance.

Luckily we have Gradle to save the day!

You can use Gradle’s command line option --stop in the project folder to stop your Android project compilation.

android-studio-terminal

Yeah, I use Windows cuz I’m a filthy casual programmer.

First, click on the Terminal icon on the bottom bar on Android Studio. While the compilation is ongoing, type the following and press Enter.

gradlew --stop

This will stop the compilation with the following message:

Failed to complete Gradle execution.
Cause:
Gradle build daemon has been stopped: stop command received

Leave a Reply

Your email address will not be published. Required fields are marked *