清除Android应用程序的用户数据应用程序、数据、用户、Android

2023-09-04 09:21:15 作者:少年与猫喵

使用的亚行外壳以清除应用程序数据。

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();                
        }

问题:

它不会清除用户数据没有给出,虽然我已经给出了以下权限的任何异常。

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"/>

问:

如何使用清除应用程序数据的亚行外壳

How to clear the application data using adb shell?

推荐答案

此命令为我工作:

adb shell pm clear packageName