I’ve been happily coding in Android Studio and using various Android Emulators for some time, but something bad happened after I updated my Android SDK to Android 5.0 a couple of days ago. Since then I’ve been dealing with Android Emulators that stop responding. Worse, the emulator starts chewing away at system memory and CPU processes until the entire system is unresponsive. I told you it was bad!
I’ll figure out what the underlying problem is in time, but until then I can keep on coding and manage any unresponsive emulators at the Linux Command Line.
Here’s ADB confirming that our emulator is offline.
Now let’s look at the process details of an emulator gone rogue.
I circled the System CPU and Memory usage (23.2% and 14.7% respectively.) Those numbers would keep growing and growing the longer I allowed the process to run. The next two columns, virtual memory and non-swapped physical memory are pretty scary, too.
There are things to try in ADB (Android Debug Bridge) like
$ adb -s emulator-5554 emu kill
but nothing I tried in ADB did squat for me.
Thanks to Linux we can easily keep emulators in control with the KILL -9 command. KILL -9 sends a signal to kill the process immediately, whether it wants to quit or not. Simply entering “kill [process-identifier]” will NOT do the job, which is why I was initially baffled by this.
Our process ID is “7616”, so the following command kills the emulator and will make it disappear from the screen.
Now we can get back to coding!