Android的;使用EXEC(QUOT;错误报告") [英] Android; using exec("bugreport")
问题描述
是否有可能在应用程序中读取终端命令 ADB #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 BufferedReader(new InputStreamReader(
process.getInputStream()));
// Test result
Log.d(TAG, "Line: "+bufferedReader.readLine());
我知道这与作品EXEC(logcat中)
,但我preFER 错误报告
,因为它包含更多的信息。
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;
错误报告是亚行命令,它无法通过常规的shell执行。但由于ADB只是输出:logcat中,dumpsys和dumpstate这些命令可以单独运行,以达到相同的结果
"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.
附加信息:
http://developer.android.com/guide/developing/tools/adb html的#commandsummary
这篇关于Android的;使用EXEC(QUOT;错误报告")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!