Battery Historian for windows環境搭建


Battery Historian for windows環境搭建

簡介:Battery historian是一款通過上傳bugreport文件分析用戶手機中App的電池耗電情況的工具。

Battery Historian 1.0 通過python腳本轉換成html文件,而新版本 Battery Historian 2.0 發布了,新版本帶來了很多的改進:更清晰的報告,每個應用程序的摘要,更快的執行等等。

 

步驟

一、首先安裝Go編程語言

  1. 點擊下載【下載】;
  2. 安裝Go;
  3. 配置GOROOT和GOPATH

    a. GOROOT的作用是告訴Go 命令和其他相關工具,在哪里去找到安裝在你系統上的Go包,所以這里配置的是GO的安裝目錄

     

 

    b.GOPATH可以簡單理解為是工程的目錄,所以創建一個GO的工程路徑

     

 

         C.最后配置一下環境變量,把Go的bin目錄放到path環境變量中

     

 

  4. 檢查Go是否安裝成功,打開命令行輸入Go version

   

 

二、安裝Git

  1. 點擊下載【下載】;
  2. 按照步驟安裝;
  3. 安裝完成檢查:命令行輸入git version

   

   也可以直接打開git bash檢查

   

 

三、安裝Python

  1. 點擊下載【下載】,注意僅支持python2.7
  2. 安裝完成;
  3. 環境變量配置,添加Path的路徑,是Python的安裝路徑
  4. 輸入命令行 python –V(注意是大寫V)檢查是否安裝成功

     

 

四、安裝Java環境

  1. 點擊下載【下載】;
  2. 完成安裝。

 

五、下載Battery Historian源碼並且運行

  1. 輸入命令行go get -d -u github.com/google/battery-historian/...

     

     **下載到GOPATH配置目錄下

  2. 進入到$GOPATH/src/github.com/google/battery-historian目錄下方
  3. 運行Battery Historian

    a. go run setup.go

    # Compile Javascript files using the Closure compiler

    $ go run setup.go


    等待數分鍾或者10分鍾左右,如果仍然沒有下載成功,可以手動下載,如下操作

    **下載【closure-library】和【closure-compiler】和【flot-axislabels】,解壓放到GOROOT目錄下third_party文件夾下方的的closure-compiler和closure-library和flot-axislabels文件夾 ../battery-historian\third_party;如果沒有均手動創建

     

    b. go run cmd/battery-historian/battery-historian.go

    # Run Historian on your machine (make sure $PATH contains $GOBIN)

    $ go run cmd/battery-historian/battery-historian.go [--port <default:9999>]

  4. 檢查/battery-historian是否運行,登錄網址 http://localhost:9999查看

六、導出手機的Bugreport日志

1.輸入指令 adb bugreport > bugreport.txt導出。

 

七、上傳bugreport.txt文件至 http://localhost:9999

  1. 上傳bug日志


  2. 查看結果

 

 歡迎加入游戲測試群QQ:574875837~~

 

參考資料:

https://github.com/google/battery-historian#wakelock-analysis


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM