Android; using exec(“bugreport”)

五迷三道 提交于 2019-12-25 02:15:13

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/6257557/android-using-execbugreport

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!