【发布时间】:2017-03-22 22:19:44
【问题描述】:
我有以下代码,但它只输出 logcat 的第一行“----beginning of main”,其余的 logcat 没有被捕获。
当我从命令行运行相同的“logcat -d -s myapp:I”时,它会显示几行。
String command = "logcat -d -s myapp:I";
Process process = Runtime.getRuntime().exec(command);
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
ArrayList<String> lines = new ArrayList<>();
String line;
while ((line = bufferedReader.readLine()) != null) {
Log.d(TAG, "Reading: " + line); // just prints "----beginning of main"
lines.add(line);
}
为什么我得到一行输出?
【问题讨论】:
标签: java android runtime.exec