1

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!

  • 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! – IAmMilinPatel Aug 20 '16 at 4:03
1

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 :)

  • 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 Jan 14 '16 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. – IAmMilinPatel Jan 15 '16 at 2:49
1

Try running this command:

adb -e emu kill

  • 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 Jan 22 '16 at 20:31
  • I tried with command: "adb -e emu kill" but nothing happened. – The Sun Jan 26 '16 at 4:05
0
$ 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, privacy policy and cookie policy

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