开发者

Android; using exec("bugreport")

开发者 https://www.devze.com 2023-03-11 21:21 出处:网络
Is it possible to read the output of the terminal command adb #bugreport from within the application?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号