http://hukai.me/android-performance-battery/可以先參考這篇文章
1$ adb shell dumpsys batterystats > xxx.txt //得到整個設備的電量消耗信息 $ adb shell dumpsys batterystats > com.package.name > xxx.txt //得到指定app相關的電量消耗信息
2安裝python 設置環境變量
3python historian.py xxx.txt > xxx.html
得到生成的xxx.html
打開后成這個樣子
Visualizer disabled. If you see this message, download the HTML then open it
這句話導致了圖表無法出現
用記事本打開源文件
前幾行發現
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization',
'version':'1','packages':['timeline']}]}"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
才知道這個路徑是被國內牆的 所以一直加載中 然后就無法顯示了
然后。。。當然是翻牆了 推薦一個vpn代理 很快的http://honx.in/i/U0etuoKo1w28DR7D#two 名字叫做紅杏 聽名字你就懂得。。。
然后打開html文件就可以了
一開始的圖片應該是這樣的