我正在使用此代码检索 logcat 消息并将它们编译到下面的数组列表(日志)中:
try {
process = Runtime.getRuntime().exec(new String[] {"logcat", "-d"});
} catch (IOException e1) {
e1.printStackTrace();
}
bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
try {
while ((line = bufferedReader.readLine()) != null){
System.out.println(line);
log.add(line);
}
}
bufferedReader.close();
}
catch (IOException e) {}
当我真正看到插入列表的内容时(通过打印'line'),我得到了两个不同的东西:
药片:
D/UsbDeviceManager( 208): updateUsbNotification mConnected = true, mConnected = true, mCurrentFunctions = mtp,adb, mUsbNotificationId = 0
电话:
06-14 00:45:14.090 1687 3676 D *PJSIP_ANDROID*: Expires: 3600
为什么设备之间的 logcat 格式不同?我可以让平板电脑看起来像手机吗?