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.
Use the emulator command to start the emulator, as an alternative to running your project or starting it through the AVD Manager. Here's the basic command-line syntax for starting a virtual device from a terminal prompt: emulator -avd avd_name [ {- option [ value ]} … ]
To stop a running emulator, click Menu and select Stop.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With