71

I'm basically trying to do this: Changing the Android emulator locale automatically

Everything works up until 'start'. the emulator starts to boot but keeps loading at the shimmering 'ANDROID' screen forever. I must be missing something... How can I restart the emulator from ADB?

Okay, I should be more specific.

I am trying to do this from the command line using adb. I can use adb to setprop and I can stop the emulator. When I try doing 'start' in the adb shell, the emulator does begin to boot, but it never returns to the lock screen.

Community
  • 1
  • 1
jeff
  • 968
  • 1
  • 6
  • 13

17 Answers17

145

In Android Studio go to:

  1. Tools > Android > AVD Manager
  2. Select your emulator device
  3. Click "Cold boot now" to restart, or "Wipe data" to factory reset
TWiStErRob
  • 44,762
  • 26
  • 170
  • 254
totas
  • 10,288
  • 6
  • 35
  • 32
100

you can try

emulator @avd_name -no-snapshot-load

it will clean load the device it worked for me.

Kiran Chenna
  • 1,562
  • 1
  • 11
  • 9
85

You asked how to restart the emulator from ADB. But the title is framed in a way that pops the question up when searching about restarting it from the UI as well.

One option could be (but it depends on which tooling you are using and may not be available for all emulators/environments) is to tap and hold the Power button and then a menu will pop up with a Restart option in it.

enter image description here


This was a long-standing default behavior, but since Android 12 / API 31 it tries to open the Google Assistant instead (even when there's no such thing on emulators without Google APIs or Google Play ). The old behavior can be reverted by going to Settings > System > Gestures > "Press and hold power button" to bring up the menu in the screenshot.

TWiStErRob
  • 44,762
  • 26
  • 170
  • 254
Nikita R.
  • 7,245
  • 3
  • 51
  • 62
  • 2
    Works for me !! (Windows 7 - Android-Studio 3) – Top-Master Jun 02 '19 at 03:52
  • 2
    Works on Linux as well. This should be the accepted answer. – Deepak Jul 31 '19 at 07:32
  • 2
    @Deepak Not really. It doesn't work if the emulator OS is freezed as in my case. I had to wipe the saved state – GabrielBB Aug 11 '19 at 03:39
  • 1
    Unfortunately now it opens the "Google Assistant" instead. How do we do restart the simulator now, from the UI? – Ben Butterworth Jan 19 '22 at 12:07
  • 1
    @BenButterworth see edit. When long-pressing the button, Logcat displays `system_process D/WindowManager: powerLongPress: eventTime=... mLongPressOnPowerBehavior=5` which refers to `com.android.server.policy.PhoneWindowManager.LONG_PRESS_POWER_ASSISTANT` constant; here we can see what other options are possible. – TWiStErRob Jan 24 '22 at 15:02
  • Works on Mac too. I use the new updated A.S. that put the emulator in a docked window. Just press the little power icon in the docked window for 3 seconds – Someone Somewhere Feb 09 '22 at 21:40
46

To restart a running emulator I used

adb -e reboot

(Assuming there is only one running)

Diederik
  • 5,536
  • 3
  • 44
  • 60
17

on Android 13, when you swipe down to the notifications, and swipe down again, you get a power off button on the bottom right:

android 13 emulator notification area

which has the Restart option:

enter image description here

mx1up
  • 724
  • 9
  • 15
11

If you are using Android Studio, you can goto the AVD Manager, Under Actions select "Cold Boot Now" to restart the emulator. This would get rid of errors/discrepancies which might occur if the simulator's process has been abruptly closed/terminated.

Karthik
  • 931
  • 2
  • 9
  • 14
  • Worth noting you need to kill/close the emulator first (seems obvious, but it had me stuck). – KERR Jan 04 '21 at 08:37
11

For me, kiran-chenna's answer failed me, and the solution was to instead run:

emulator -avd Pixel_2_API_28 -no-cache
Ben Hayward
  • 191
  • 3
  • 15
11

In my case, a cold boot was required after the emulator got stuck. It can be found in the Android Virtual Device Manager.

enter image description here

Alexander Pacha
  • 9,187
  • 3
  • 68
  • 108
  • What is the meaning of cold boot ? – Hanako Apr 19 '21 at 14:26
  • 1
    A cold boot usually refers to a system start after completely turning off the power. A warm or hot boot is when you simply restart the system after it was already running (the CPU is still hot). In this case, cold boot means completely restarting the VM instead of resuming from a stored snapshot. – Alexander Pacha Apr 21 '21 at 07:26
  • [This answer](https://stackoverflow.com/a/68688915/6243352) provides a clearer sequence of steps for cold booting. – ggorlen Oct 01 '21 at 20:29
11

I'm pretty sure this will work:

  • Clear/Wipe the AVD to defaults or create a new one.

  • Start the AVD/Emulator from the CLI with the following command

    emulator -avd my_avd -prop persist.sys.language=en -prop persist.sys.country=GB
    

change as needed. That way you are not messing with the system image which can cause hangs/crashes. And you can easily set it on boot for a variety of Locales.

TryTryAgain
  • 7,632
  • 11
  • 46
  • 82
  • 1
    I think I will end up doing something like this. The only downside is that when I am changing language/country again I have to totally kill the emulator every time. Which I guess isn't so bad. – jeff Mar 21 '12 at 19:05
  • @jeff Right, well it's either kill it and start from the CLI this way, or set it with ADB and restart it...so, pretty much the same pain I guess. IMO just a little easier from the CLI one-liner. – TryTryAgain Mar 21 '12 at 19:09
  • 1
    Is there a way to "Clear/Wipe the AVD" via the command line? – Luke Nov 09 '20 at 16:22
6

Follow the following steps to restart/cold-boot your virtual device:

  1. Open Android Studio
  2. Click on Configure
  3. Click AVD Manager
  4. Click on the Dropdown on the right hand side of the virtual device.
  5. Click on Cold Boot Now

You're done! The device will restart within a couple of minutes.

enter image description here

3

2022 Android Studio Bumblebee: With the emulated device open on screen (the "Emulator" tab open), press and hold the power button at the top of window just as you would on a real device, and it will pop up the device's menu just as if you had held the button on the side of a real device. For example:

enter image description here

simpleuser
  • 1,617
  • 25
  • 36
2

To start/stop or restart emulator follow these steps:

using telnet on windows machine

or localhost 5554

avd start start

or

avd start restart

or

avd stop
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Pratham
  • 71
  • 3
2

If the power button (top left of Emulator) is opening up assistant:

  1. Tell/type to Assistant to open "Settings" (or double drag down the battery/antenna icon on top right)
  2. Search for "Power"
  3. Go to "Power Gesture"
  4. Turn that off!

enter image description here enter image description here

Aidin
  • 25,146
  • 8
  • 76
  • 67
1

You can try this

emulator @avd_name -no-snapshot-load

or else Simply delete the existing AVD and try to create a new one.

By following the steps. In Android Studio > Tools > Device Manger > Create Device

1

Some versions of the emulator (android-7) are buggy and just hang at the shimmmera.

Try restarting it with "wipe user data" option (yes, you will have to re-run your app or at least reinstall it).

idarwin
  • 607
  • 4
  • 19
0

in eclipse in the top most right u will find DDMS go i there, left side you will find Devices and in that in the last you will find a triangle downwards press that in that you will find Reset adb.

0

you can restart the emulator from adb shell, start the emulator and also adb shell in the terminal.

start Starts (restarts) an emulator/device instance.
stop Stops execution of an emulator/device instance.

prijupaul
  • 2,076
  • 2
  • 15
  • 17
  • This is what i'm trying! I'm in the terminal, i'm using adb. I can make the prop changes, i can stop the emulator, but when I do 'start' it just never finishes booting up. – jeff Mar 21 '12 at 18:29