Android; using exec("bugreport")
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 BufferedR开发者_运维知识库eader(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.
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
精彩评论