Clear android application user data

UdayaLakmal picture UdayaLakmal · Jun 7, 2012 · Viewed 116.4k times · Source

Using adb shell to clear application data

adb shell pm clear com.android.browser

But when executing that command from application

String deleteCmd = "pm clear com.android.browser";      
        Runtime runtime = Runtime.getRuntime();
        try {
            runtime.exec(deleteCmd);
        } catch (IOException e) {
            e.printStackTrace();                
        }

Issue:

It doesn't clear the user data neither gives any exception though I have given the following permission.

<uses-permission android:name="android.permission.CLEAR_APP_USER_DATA"/>

Question:

How to clear the application data using adb shell?

Answer

Manmohan Soni picture Manmohan Soni · Oct 16, 2014

This command worked for me:

adb shell pm clear packageName