clearAppData("pm clear cn.test.testui");

public void clearAppData(String string){
      BufferedReader bfrBufferedReader  = null;
      String lineString = null;
      InputStream isInputStream = null;
      InputStreamReader isInputStreamReader = null;

      try {
          Process process = Runtime.getRuntime().exec(string);
          isInputStream = process.getInputStream();
          isInputStreamReader = new InputStreamReader(isInputStream);
          bfrBufferedReader = new BufferedReader(isInputStreamReader);
          while((lineString = bfrBufferedReader.readLine())!=null){
              System.out.println(lineString);
          }
      } catch (IOException e) {
          System.out.println("false!!!!!!!!!!!!");
      }
  }

然后运行完会报错,如图:

请大神们指教下这是由于什么原因导致的呢,我只是想清除下 app 的缓存而已。。。


↙↙↙阅读原文可查看相关链接,并与作者交流