Is there any legitimate way of Gradle task(s) execution stopping in Android Studio?
问题:
回答1:
you can call ./gradlew --stop
in a Terminal and it will kill all gradle processes
回答2:
No, Gradle (as of this writing, v1.10) has a limitation that you can't cancel tasks through its tooling API, which is what Android Studio uses to communicate with its daemon. You can track the progress of this at https://code.google.com/p/android/issues/detail?id=59464 . It's also preventing progress on something else we'd like to be able to do, https://code.google.com/p/android/issues/detail?id=59965
In the meantime about all you can do is to go through your OS and kill the Gradle processes manually, which is a little painful and messy. It's possible that it could leave your build in some intermediate bad state which would mess up future incremental compiles, but I don't know for sure.
回答3:
With Android Studio 1.3.2 a kill button appears when the gradle is building on the very bottom of the IDE screen.
It doesn't seem to do anything, but at least there's something to push. Wheee! :D
回答4:
Quitting Android studio is another way it'll kill the gradle daemon or if it's hung deploying to Android device unplugging the device can halt the process (neither are ideal solutions)
回答5:
Thanks to Rami Kuret and Flavio Faria.
You can call .\gradlew --stop in a Terminal and it will kill all gradle processes in Android Studio for Windows OS.
You Can find terminal at left bottom of your android studio for windows.
回答6:
I know this is an old question but now with Android Studio 1.2, you can cancel current gradle task by quitting Android Studio, it'll open a Confirm exit dilog says there's a background running task, choose Exit, then there will be another dialog to cancel background task, choose Yes and gradle task will be canceled without quitting studio.
Remember to clean project before run other build task, or something might be messed up.
(I'm on Mac OS X)
回答7:
Just something quick I found out, if you want to end the process you can also:
- Go into Task Manager by right-clicking the taskbar then going to "Task Manager" or simply by CTRL + SHIFT + ESC
- Then ending the Java process that's running.
回答8:
When every other method fails just use:
ps -A | grep gradle | awk '{ print $1; }' | xargs kill -9
to get the list of every process with a 'gradle' keywork and kill it forcefully.
回答9:
There is an Android Studio Plugin for that: https://github.com/shchurov/GradleStop. It will just add a "gradle stop" command and menu item which will call ./gradlew --stop.
回答10:
just execute .\gradlew --stop
in terminal which is located on bottom of the android studio after it kills the gradle process , Clean the project and re-run the project
hope this will help you
see the image for more information
回答11:
Not a "legitimate" way but this is what i do.
- Click on Gradle Sync while your build process is ongoing.
- Android Studio will warn you with something like "Continue with Project Closing?". Click yes.
The build process will be cancelled and the gradle Sync operation will begin which is relatively quicker (as compared to waiting for the whole build process to complete, as i have a project with MANY library modules)
回答12:
The way I solved this was: Go to your project-->graddle-wrapper.properties(Graddle Version) - Then edit the distributionURl to the version you want. Here's a picture:
回答13:
there is two easy way exist to stop it without killing process.
the first one is that you load two project
with android studio, and when you close your project, the gradle building project, it will close immediately.
the second one is simply click on the file
and click close project
and it will stop instantly.
the benefits of these method is, you don't need to wait too much to start android studio again.
回答14:
Kill studio.exe process from Taskmanager and then Restart your machine. This is the only thing that working for me. If you kill every related process and don't restart the machine, you can't run or build your app because it will say "Another gradle instance running
回答15:
As of Android Studio 3.0, the little red cross button next to the gradle build status indicator bar seems to be working!
回答16:
On windows, goto run by pressing windows-logo + R and type taskkill /f /im studio64.exe
that will kill android studio and stop gradle