Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close Android Studio using terminal in Ubuntu

I'm Ubuntu & Android beginner. I need help to close Android Studio using the terminal or a solution to resolve the error which is shown in this image:

android_error

like image 727
Neeraj Kumar Avatar asked Jul 16 '16 09:07

Neeraj Kumar


People also ask

How do I close a program in Ubuntu terminal?

In Linux, you can use the Ctrl+C keys to stop a running program in the terminal. This works for Ubuntu as well as any other Linux distribution.

How do I close android studio?

How To Close, Save Android Studio Project. To close the project you need to click the ” File —> Close Project ” menu in the top menu bar. To save the Android project, you need to click the ” File —> Save All ” menu in the top menu bar.

How do I close the Android console?

To exit a session, touch Close Session from the menu . If you are the session owner, End Session closes the session page in your access console and removes any additional members who may be sharing the session.

How do I open Android Studio in terminal?

To launch Android Studio, open a terminal, navigate to the android-studio/bin/ directory, and execute studio.sh . Select whether you want to import previous Android Studio settings or not, then click OK.


Video Answer


2 Answers

pkill java 

Is the easiest one.

EDIT

Many people have made use of the command above, however, there is a drawback to using it: All Java applications running as your user will be killed.

To fix this, I've made a oneliner which will kill one Android Studio instance. This may or may not work on your particular system but is a better solution than the one mentioned above if it happens to work for you.

ps -eo pid,cmd | grep -Ev "^ {0,1}([0-9]*) grep.*" | grep -E 'java.*android-studio' | sed -re 's/ {0,1}([0-9]*) .*/\1/' | head -n1 | xargs kill -9 

This will search for java.*android-studio in the commands of your process list and kill the associated process using its PID.

like image 130
xdevs23 Avatar answered Sep 20 '22 14:09

xdevs23


killall -9 java 

It works for me.

like image 38
Ritesh Adulkar Avatar answered Sep 22 '22 14:09

Ritesh Adulkar