I need the bugreport option that you can use in adb to go to a file on the sd in my app. I found Android; using exec("bugreport") that explains that you can not run bugreport in the regular shell and that you need to run dumpstate, dumpsys, and logcat separately to get the same result. That is fine and I understand that, but I can not get dumpstate or dumpsys to write to the file. The below works fine to write the logcat using logcat -d -f, but does not work for the other two. I have tried dumpstate -f , dumpstate -d -f and dumpstate > to get it work, but still does not write anything to the file. Is there something I am missing to make this work?
This is where I am creating the file on the sd
File folder = new File(Environment.getExternalStorageDirectory()+"/IssueReport/");
if (folder.isDirectory() == false) {
folder.mkdir();
}
log = new File(Environment.getExternalStorageDirectory()+"/IssueReport/log.txt");
and here is where I am writing the file to the location
private void submit() {
try {
log.createNewFile();
String cmd = "dumpstate "+log.getAbsolutePath();
Runtime.getRuntime().exec(cmd);
} catch (IOException e) {
e.printStackTrace();
}