我有一个Java文件,其中包含这段代码以列出应用程序的缓存目录中的文件,并且效果很好。
String command[] = {"adb","shell","run-as",pack,"ls","cache/"};
Process process = Runtime.getRuntime().exec(command);
InputStream o_out = process.getInputStream(); //covert o_out to String to get the files name
现在,我想将此代码直接在android设备上运行,但由于命令错误,知道了吗,失败了?
答案 0 :(得分:-1)
尝试一下:
String command[] = {"run-as",pack,"ls","cache/"};