[Android]delete data stored in AccountManager via adb

As you know, you can remove local application data via adb command.

$ adb shell am clear your.package.name

The command is very useful to do Android test against release module with uiautomator, Appium an so on. But, if your application use AccountManager provided by Android platform, the command can’t remove the data stored via account manager.

What you can do is…

  1. Uninstall the app and install again.
  2. Remove account via application.

To make faster and more stable some Android test, 2 is better choice. Because installing apks take a lot of time.

So, I developed the simple application. Anyone can remove data via adb command if you install the following application into your target device.

https://github.com/KazuCocoa/DroidTestHelper

After installing DroidTEstHelper app in your target device, you only do the following broadcast command. Then data which is stored in Account Manager is remove.

$ adb shell am broadcast -a 'DroidTestHelper' --es ACCOUNT_TYPE your.target.account.type

You should replace your.target.account.type to your target account type.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s