android電量分析
準(zhǔn)備工作--環(huán)境配置
注意Python 要使用2.7 系列的
下載路徑:
https://www.python.org/
下載完之后
配置環(huán)境變量
檢查是否成功
cmd 輸入 python
Go語(yǔ)言環(huán)境配置
下載路徑:
https://golang.org/doc/install#testing
配置環(huán)境變量
檢查是否成功
cmd 輸入go version
配置Java環(huán)境
略
下載Battery Historian
下載路徑:
https://github.com/google/battery-historian
操作步驟
1.adb kill-server
2.adb devices 查看連接的設(shè)備,保證是一臺(tái)
3.adb shell dumpsys batterystats --enable full-wake-history
adb shell dumpsys batterystats --reset
初始化操作,重置電量,防止其他數(shù)據(jù)的干擾
4.拔掉USB線 玩一會(huì)兒應(yīng)用
5.插上USB線 輸入 adb bugreport > bugreport.txt
會(huì)提示:
`
Bugreport is in progress and it could take minutes to complete.
Please be patient and do not cancel or disconnect your device until it completes.
`
然后會(huì)生成一個(gè)bugreport的zip文件
下面的這個(gè)步驟沒有用到
python historian.py bugreport.txt> bugreport.html
6.進(jìn)入battery historian的路徑
打開bash 然后輸入
go run cmd/battery-historian/battery-historian.go
彈出類似如下信息
2018/07/26 20:13:48 Listening on port: 9999
2018/07/26 20:13:48 listen tcp :9999: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
exit status 1
7.在瀏覽器中輸入
8.上傳步驟5中生成的zip文件 會(huì)生成電量分析表(這個(gè)好像需要梯子)