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
You can wipe data while starting emulator in ADT plugin, just mark checkbox:
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
Open command prompt,
android-sdk-windows\tools>emulator -avd -wipe-data
example-
emulator -avd androidavd2 -wipe-data
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.
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