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?
The command
pm clear com.android.browser
requires root permission.So, run
su
first.Here is the sample code:
The class
StreamReader
:This command worked for me:
adb uninstall com.package.packagename
execute this command on ADB shell.
adb uninstall com.package.packagename -k
-k will retain the user data
To clear Application Data Please Try this way.
Hello UdayaLakmal,
Please check this and let me know...
You can download code from here