Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
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.
Java environment has been configured
Download chkbugreport.jar (please change the name to chkbugreport.jar after downloading)
Save the following code to the same directory as chkbugreport
# -*- coding: utf-8 -* import os from subprocess import Popen, PIPE
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:
If __name__ == '__main__':
If devices() == 1:
# 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
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.