1

Is it possible to read the output of the terminal command adb #bugreport from within the application?

I tried the following but I couldn't manage to get any output.

Process process = Runtime.getRuntime().exec("bugreport");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
// Test result
Log.d(TAG, "Line: "+bufferedReader.readLine());

I know it works with exec("logcat"), but I prefer the output of bugreport as it contains more information.

Nick Stemerdink
  • 1,067
  • 9
  • 22

1 Answers1

4

A while ago I found the solution to this problem;

"bugreport" is a adb command it cannot be executed via the regular shell. But since adb just outputs: "logcat", "dumpsys" and "dumpstate" these commands can be run individually to achieve the same result.

Additional info: http://developer.android.com/guide/developing/tools/adb.html#commandsummary

Nick Stemerdink
  • 1,067
  • 9
  • 22
  • Can you explain a little bit more about the bugreport command? I try to run it via the runtime exec but I can't collect the output. – Zach Bublil Feb 04 '19 at 09:15