I got below errors while trying the above question . does anyone know what's going wrong?
$ adb devices
List of devices attached
emulator-5554 device
$ emulator -avd -wipe-data
PANIC: Could not open: -wipe-data
$ emulator -avd emulator-5554 -wipe-data
PANIC: Could not open: emulator-5554
Open command prompt,
android-sdk-windows\tools>emulator -avd -wipe-data
example-
emulator -avd androidavd2 -wipe-data
You can wipe data while starting emulator in ADT plugin, just mark checkbox:
So I know this question is a few years old. But I'm going to answer anyways because no answer has been accepted.
FIRST, make sure that (your-android-sdk-location)/tools is on your $PATH. It wouldn't hurt to verify this by using which emulator from the terminal. For example when I do this it outputs:
/Users/chris.w.newman/Library/Android/sdk/tools/emulator
SECOND, find where your AVDs are located. By default it is located in the .android/avd directory in your User account folder. So for me it is here:
/Users/chris.w.newman/.android/avd
THIRD, cd to the above directory and get the list of devices you have created by listing them with ls
chriswnewmans-MacBook-Pro:~ chris.w.newman$ cd /Users/chris.w.newman/.android/avd
chriswnewmans-MacBook-Pro:avd chris.w.newman$ ls
Nexus_5_API_19.avd Nexus_5_API_19.ini
Note that every device has a pair of results, an .avd folder and an .ini file. You can see that I have one device whose name is Nexus_5_API_19.
FOURTH, to wipe the data of the device from the terminal you use the emulator -wipe-data command. Some people might find this annoying because it will ALSO launch the emulator after it finishes wiping the data. Anyways here's how you do it:
emulator -avd Your_Device_Name -wipe-data
The main reason I find this approach to wiping data annoying is that now the emulator is running from the terminal. That means if I wanted to do more work in the terminal, I would either need to open another terminal (I hate having multiple terminals open), or close my emulator to free up the terminal.
For completeness sake, I will mention that you can wipe the data of an emulator from the AVD manager (at least the one that is built into Android Studio). Open the AVD manager and in the list of devices, all the way on the right hand side you click the dropdown arrow and select Wipe Data. This wipes the data without launching the emulator.
I have Windows10 and using Android Studio 3.4
Follow the steps:
Tools -> AVD Manager -> Right Most Button under Actions(Down triangle Icon) -> Wipe Data
This image shows the steps in a screenshot.
Try:
emulator -list-avds
EMULATOR_NAME will be displayed
emulator -avd EMULATOR_NAME -wipe-data
Example:
emulator -list-avds
Pixel_XL_API_29
emulator -avd Pixel_XL_API_29 -wipe-data
Related
When I recently studied React Native, I needed to use an emulator to test (when I don’t need a mobile phone to run).But every time you have to start Android Studio and then start the emulator, it is very troublesome to operate twice,
You can start your emulator by using command line, by open your CMD in your sdk folder / emulator. Then try this command
emulator -list-avds
To list your virtual devices and then
emulator -avd <device_name>
You can find the detail here
https://developer.android.com/studio/run/emulator-commandline#starting
Hope that help. ^^
You can start emulators from the terminal/ CMD without opening Android Studio.
To get the list of AVDs (run from sdk/emultor folder)
emulator -list-avds
To run any avd
emulator -avd avd_name [ {-option [value]} … ]
or,
/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full
For more details refer - Official guide
I am trying run appium test case on android emulator,but there is a confusing situation.
The test case will start a specified activity, is very fast on the android emulator from avd manager(5-6s).
avd manager:
avd manager
The android emulator from command line is also relatively smooth,but the test case start the specified activity very slow(20-30s).It can fast infrequently(1%-2%).
command line:
emulator -avd Nexus_5_API_27
The avd is same.So,is there any difference between the same avd from command line and from avd manager ?
I've tried a lot of acceleration options but they don't work.
When you open emulator from avd then it opens using commandline itself but with some startup options. Following command is executed when you run emulator from avd
emulator -avd Nexus_5X_API_21 -netdelay none -netspeed full
Try to include these options in your command line instead of normal run. You can run your command like this:
emulator -avd Nexus_5_API_27 -netdelay none -netspeed full
i hope it will help you.
I've got the command to boot a sim and wipe the data
emulator -avd myemu -wipe-data
but how can I wipe the data of the sam AVD without booting it?
How about all AVDs which are not booted?
You can wipe the emulator's data using the Wipe user data option when starting the emulator from the Android AVD Manager. If you are using the command line SDK instead, you can switch to the GUI tools as detailed on this page, which is more convenient than dealing with the command line arguments.
on Ubuntu 16.04 I have installed AndroidStudio and via its AVD manager GUI did create tow new devices. now on Terminal when I type emulator -list-avds it lists the devices correctly, but when run emulator -avd <name> I face errors:
[139684796983104]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at ../emulator/lib64/qt/lib
Could not launch '/home/amir/../emulator/qemu/linux-x86_64/qemu-system-i386': No such file or directory
How should I solve it?
both in Windows 10 and Ubuntu I was facing the same problem. the simple solution is that I had to go to the directory of tools then execute the command. for instance in windows.
$ cd C:\Users\user-name\AppData\Local\Android\sdk\tools
emulator -avd <deviceName>
also it is good to mention I wanted that for React-Native development, and Expo XDE saved me
I'm trying to run android emulator on terminal I have downloaded android sdk on VM ubuntu server (Thus I dont have graphic desktop, only terminal console).
I want to run emulator on terminal as a service that I can use for install App and run some tests(battery consumption, install, others).
I want to create some AVD and run test scripts on it.
But, I cant launch emulator without graphic desktop. Is it possible?
I find that it's possible start Android Emulator without graphic with this command:
$emulator -avd <avd_name> -no-window
Also you can add other commands to clean data on emulator
$emulator -avd <avd_name> -no-window -wipe-data