How to cold boot emulator using commend line(CMD)

Viewed 6619

I am trying to open emulator without opening android studio every time while developing react-native. Emulator can be opened using this lines of code.

cd C:\Users\<your_user_name>\AppData\Local\Android\Sdk\emulator
emulator -list-avds
emulator @<your_adb_name>

But now I want to cold-boot emulator some times to resolve emulator not responding issue using cmd. Any idea to solve that?

Thanks in advance.

3 Answers

I am able to solve my this problem using -no-snapshot-load with emulator @<your_adb_name>

cd C:\Users\<your_user_name>\AppData\Local\Android\Sdk\emulator
emulator -list-avds
emulator @<your_adb_name> -no-snapshot-load

On linux, if you add this to your .bashrc, when you call avd-coldboot (or whatever you decide to name it) you will get a list of AVDs to select from for cold-booting.

This should work regardless of how many AVDs you have set up

function avd-coldboot {
echo 'Choose Android AVD to cold-boot:'

select avd in $(emulator -list-avds);
do
  if [ -n "$avd" ]
  then
    echo "Cold-booting AVD '$avd'"
    emulator @$avd -no-snapshot-load
    break
  else
    echo "Unknown option: '$REPLY'"
  fi
done
}

Example terminal I/O

~/jnk$ avd-coldboot
1) Pixel_3a_API_30
2) Pixel_4_API_30
#? 1 
emulator: Android emulator version 30.7.5.0 (build_id 7491168) (CL:N/A)
  • reach to the folder where your sdk is install and go to emulator folder in it.
  • open cmd from this folder.
  • run this command emulator -list-avds to get installed avds.
  • For run the avd with cold boot(boot) you can do it like this
  • i have this avd installed Pixel_5_API_30
  • run this command and write the avd name in Capital letter emulator @PIXEL_5_API_30 you will get your booted avd ready cheers
Related