我需要bugreport选项,您可以在adb中使用该选项转到我的应用中的sd文件。我找到Android; using exec("bugreport"),它解释了你不能在常规shell中运行bugreport,并且需要单独运行dumpstate,dumpsys和logcat以获得相同的结果。这很好,我明白,但我不能得到dumpstate或dumpsys写入文件。以下工作正常使用logcat -d -f编写logcat,但不适用于其他两个。我已经尝试过dumpstate -f,dumpstate -d -f和dumpstate>来使它工作,但是仍然没有向文件写任何东西。有没有什么我失踪,使这项工作?
这是我的SD将dumpstate写入文件android
File folder = new File(Environment.getExternalStorageDirectory()+"/IssueReport/");
if (folder.isDirectory() == false) {
folder.mkdir();
}
log = new File(Environment.getExternalStorageDirectory()+"/IssueReport/log.txt");
这里创建该文件是我在哪里文件写入到的位置
private void submit() {
try {
log.createNewFile();
String cmd = "dumpstate "+log.getAbsolutePath();
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
e.printStackTrace();
}
执行此代码行Process p = Runtime.getRuntime()。exec(“/ system/bin/sh - ”);将所有日志放在一起?如果我创建一个空项目并执行submit()方法,它会写上一个应用程序粉碎报告吗? –