views:

85

answers:

1

I have read that in order to clear data stored in the Android emulator I should start the emulator with the "-wipe-data" arguments. However, I can't see how to specify startup arguments. I have read that it should be possible to specify these in the "Target" tab of the Debug Configurations dialog. However, if I open Debug Configurations from the Eclipse Run menu all I see in the Target tab are radio buttons for "Manual" or "Automatic" Deployment Target Selection Mode, buttons for "Refresh" and "Manager..." and drop-down boxes for "Network Speed" and "Network Latency" options. There are buttons for "Details..." and "Start..." but these are grey. I can't see anywhere where I can enter a "-wipe-data" option. The Run Configurations dialog seems to be identical. (I am using Eclipse SDK 3.5.2)

A: 

Since asking this question I have found out how to use the "ADB Shell" to wipe the data, and have found that the "Shell" is not as intimidating as it sounds.

For the benefit of any Windows user reading this who is not sure about using the Shell, this is what I did:

  • as a prerequisite I ensured that I had followed the instructions in the Android SDK documentation (http://developer.android.com/sdk/installing.html) on including the "SDK Tools" folder in my Windows "Path" variable ... this avoids having to type in the full path name to the Tools folder whenever using one of the tools

  • from the Windows Start menu I selected "Run" and typed in "cmd" (without the quotes) to open a Windows Command window

  • after the Windows Command Prompt ">" I typed "adb shell" (without the quotes) and hit the return key, which popped up an ADB prompt in the Command Window, which looks like "# ". (Note: in order for this to work it seems to be necessary to have the Android emulator running; if not, "error: device not found" is reported.)

  • at the ADB prompt (i.e. after "# ") I typed as a single line rm data/data/[package name, e.g. com.aaa.bbb]/databases/[Database name] and hit the return key

  • this wiped the data from my app within the emulator, as I was able to confirm by looking in the File Explorer in the DDMS window and confirming that my package no longer appeared under the data/data folder.

Having said all this, it would obviously be preferable if I could amend the Run Configuration so that the data is automatically wiped every time the app is run in the emulator, so if anyone knows the answer to my original question I should be very pleased to hear it!