3

I'm trying to handle AVD headless emulator from command line on window 7. I start AVD emulator with command:

"emulator -avd emulator -no-audio -no-window"

and then i try to shut it down by closing command prompt, using command:

"adb kill-server", "adb reboot -bootloader", "android -s emulator -emu kill"

But it still keeps on running.

Please help me! Best Regards!

1
  • has any of the given solutions worked for you? If yes, it would be good to accept an answer so that the question doesn't remain in the unanswered list! Commented Aug 20, 2016 at 4:03

3 Answers 3

2

If the command doesn't kill the server, that is the server doesn't turn off, then open the task manager and go to the Processes tab. In the Processes tab look for the process adb.exe and kill/close/end that process and viola, your server will shutdown/close/stop.

OR

In command prompt,

  1. change directory to c:\windows\systen32.
  2. Run the command tasklist. You will get the list of tasks running.
  3. Note down the PID of the task you want to kill.
  4. Run this command - Taskkill /PID [you task's pid] /F
  5. to kill multiple tasks run the command with space separated PIDs - Taskkill /PID [you task's pid] [you task's pid] [you task's pid] /F

Happy Testing :)

2
  • Thanks for your answer! Now, I want to code automation test, so i wanna call start or shut down emulator by using command line. When i run start emulator headless again, there is one emulator created ( have 2 emulator headless). Are there any way to shut down it by using command line? Best Regards!
    – The Sun
    Commented Jan 14, 2016 at 3:04
  • Well to kill the emulators from command line you'll have to use the commands you've mentioned in the question. At least that's what the Android's site says - "developer.android.com/tools/help/adb.html". If that doesn't work you can try the other method mentioned above. Commented Jan 15, 2016 at 2:49
4

Try running this command:

adb -e emu kill

3
  • 1
    Hey Seth, while this might be exactly what OP needs, I think we can both agree that blindly copying command lines off a post is bad for future visitors. Could you explain what the parameters mean, so future people who land here can determine if this command is right for them? Thanks!
    – corsiKa
    Commented Jan 22, 2016 at 20:31
  • I tried with command: "adb -e emu kill" but nothing happened.
    – The Sun
    Commented Jan 26, 2016 at 4:05
  • command worked for me!! Thanks Commented Sep 13, 2022 at 17:56
1
$ adb -e emu kill 

worked for me, I want create a bash script for my CI to 1st start an emulator before compiling the project then killing the emulator after it has been completed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.