In the Android system test, it is often necessary to grab the log, and the built-in BugReport function is the most convenient and comprehensive. Then the problem comes. BugReport contains a lot of information, but it becomes troublesome to analyze. Of course, it is not only me who have trouble, but also space2. The predecessor wrote an open source tool called chkbugreport for this purpose, which can directly analyze the BugReport. Well, my troubles have been solved by others. At the same time inspired by colleagues, the chkbugreport tool has been enhanced to achieve a one-click analysis of BugReport ^ _ ^, very simple, is to get the BugReport and analysis BugReport together, all take Python practice.
premise:
Java environment has been configured
Download chkbugreport.jar (please change the name to chkbugreport.jar after downloading)
method:
Save the following code to the same directory as chkbugreport
run
# -*- coding: utf-8 -* import os from subprocess import Popen, PIPE
Def devices():
'''
Get device information, give return value according to different status
1. When the device is not connected, the return value is 0.
2. When only one device is connected, the return value is 1
3. When multiple devices are connected, the return value is 2
'''
Resp = Popen(
'adb devices', shell=True, stdout=PIPE, stderr=PIPE).stdout.readlines()
Cmd = []
For i in resp:
Cmd.append(i.strip('\r\n'))
If __name__ == '__main__':
If devices() == 1:
Analysis_bugreport()
# raw_input('Press Enter key to continue......')
International practice, thanks to space2, and my colleague Zheng Hong recommended chkbugreport to me. In fact, the original blogger wrote so much, and extracted two things:
1, adb shell bugreport > bugreport.log Get the system's bugreport report
2. Place the report generated above and the downloaded chkbugreport.jar in the same directory and run java -jar chkbugreport.jar bugreport.log
Will automatically generate the corresponding html file
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.