Battery Historian2.0 windows下安装及报错解决

Battery Historian2.0安装,具体操作步骤如下:

一.安装Go编程语言
1.Windows 下可以使用 .msi 后缀的安装包来安装;
下载地址:https://golang.google.cn/dl/
Battery Historian2.0 windows下安装及报错解决

2.一路Next安装完成后,配置GOROOT和GOPATH;
1)GOROOT配置的是GO的安装目录;
2)GOPATH是自己创建的一个GO的工程目录;
Battery Historian2.0 windows下安装及报错解决
3)还要把Go的bin目录放到PATH环境变量中;
Battery Historian2.0 windows下安装及报错解决
4)检查是否安装成功,打开命令行输入go version;
Battery Historian2.0 windows下安装及报错解决

二.安装Git
1.下载地址:https://git-scm.com/
Battery Historian2.0 windows下安装及报错解决
2.一路Next安装完成,命令行输入git version检查是否安装成功;
Battery Historian2.0 windows下安装及报错解决

三.安装Python
1.下载地址:https://www.python.org/
***注意仅支持python2.7
Battery Historian2.0 windows下安装及报错解决
Battery Historian2.0 windows下安装及报错解决
Battery Historian2.0 windows下安装及报错解决
2.一路Next安装完成,配置环境变量,在Path中配置Python27的安装地址;
Battery Historian2.0 windows下安装及报错解决
3.回到Python的安装目录,复制粘贴python.exe,并修改名字为python27.exe,与python3区分;
Battery Historian2.0 windows下安装及报错解决
4.验证安装是否成功;
Battery Historian2.0 windows下安装及报错解决
四.安装Java环境
1.下载地址:https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
Battery Historian2.0 windows下安装及报错解决
Battery Historian2.0 windows下安装及报错解决
2.一路Next安装完成,配置环境变量:
1)新建->变量名"JAVA_HOME",变量值为JDK的安装路径;
Battery Historian2.0 windows下安装及报错解决

2)编辑->变量名"Path",加上 %JAVA_HOME%\bin
Battery Historian2.0 windows下安装及报错解决
3.验证安装是否成功;
Battery Historian2.0 windows下安装及报错解决
五.下载Battery Historian源码并且运行
1.打开Git Bash,输入:

go get -d -u github.com/google/battery-historian/...

Battery Historian2.0 windows下安装及报错解决
2.等待一段时间;
3.下载完成,遇到第一个坑!提示找不到 google.golang.org/protobuf,应该是墙的原因;
Battery Historian2.0 windows下安装及报错解决

package github.com/google/battery-historian
        imports google.golang.org/protobuf/encoding/prototext: unrecognized import path "google.golang.org/protobuf/encoding/prototext": https fetch: Get "https://google.golang.org/protobuf/encoding/prototext?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
package github.com/google/battery-historian
        imports google.golang.org/protobuf/encoding/protowire: unrecognized import path "google.golang.org/protobuf/encoding/protowire": https fetch: Get "https://google.golang.org/protobuf/encoding/protowire?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
package github.com/google/battery-historian
        imports google.golang.org/protobuf/proto: unrecognized import path "google.golang.org/protobuf/proto": https fetch: Get "https://google.golang.org/protobuf/proto?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
package github.com/google/battery-historian
        imports google.golang.org/protobuf/reflect/protoreflect: unrecognized import path "google.golang.org/protobuf/reflect/protoreflect": https fetch: Get "https://google.golang.org/protobuf/reflect/protoreflect?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
package github.com/google/battery-historian
        imports google.golang.org/protobuf/reflect/protoregistry: unrecognized import path "google.golang.org/protobuf/reflect/protoregistry": https fetch: Get "https://google.golang.org/protobuf/reflect/protoregistry?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
package github.com/google/battery-historian
        imports google.golang.org/protobuf/runtime/protoiface: unrecognized import path "google.golang.org/protobuf/runtime/protoiface": https fetch: Get "https://google.golang.org/protobuf/runtime/protoiface?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
package github.com/google/battery-historian
        imports google.golang.org/protobuf/runtime/protoimpl: unrecognized import path "google.golang.org/protobuf/runtime/protoimpl": https fetch: Get "https://google.golang.org/protobuf/runtime/protoimpl?go-get=1": dial tcp 216.239.37.1:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

解决办法:
1)找到你的GOPATH/src目录,新建google.golang.org文件夹
Battery Historian2.0 windows下安装及报错解决

2)在google.golang.org目录下执行:

git clone https://e.coding.net/robinqiwei/googleprotobuf.git protobuf

Battery Historian2.0 windows下安装及报错解决
参考:https://blog.csdn.net/weixin_44448273/article/details/105571483

4.手动下载【closure-library】和【closure-compiler】和【flot-axislabels】,解压放到GOROOT目录下third_party文件夹下方的的closure-compiler和closure-library和flot-axislabels文件夹,需要手动创建;
Battery Historian2.0 windows下安装及报错解决

5.进入$GOPATH/src/github.com/google/battery-historian目录下方,输入命令进行编译:

go run setup.go

Battery Historian2.0 windows下安装及报错解决
6.运行Battery Historian

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

7.检查/battery-historian是否运行,登录网址 http://localhost:9999查看
Battery Historian2.0 windows下安装及报错解决
六.上传bugreport文件,查看报告
1.连接安卓手机,导出文件;

adb bugreport > bugreport.txt

2.上传文件,遇到第二个坑!没有显示提交按钮;
Battery Historian2.0 windows下安装及报错解决
查看F12,显示ajax.googleapis.com、cdnjs.cloudflare.com等资源无法访问,可以在本地提供这些资源:
Battery Historian2.0 windows下安装及报错解决

解决办法:下载地址
1)下载base.html 替换原码下的 battery-historian\templates\base.html
2)下载好cdn目录 放入到battery-historian\third_party 目录
3)进行 cd $GOPATH/src/github.com/google/battery-historian
4)运行 go run setup.go 进行编译
5)运行 go run cmd/battery-historian/battery-historian.go

3.重新登录网址 http://localhost:9999,上传文件;
Battery Historian2.0 windows下安装及报错解决
遇到第三个坑!提示:Note: Could not parse aggregated battery stats.
Battery Historian2.0 windows下安装及报错解决

解决办法见GitHub lilydjwg,需要修改本地工具代码。

安装结束!!!
Battery Historian2.0 windows下安装及报错解决

参考:
https://blog.csdn.net/qq_26100545/article/details/108163244
https://blog.csdn.net/feitian_666/article/details/52756522

上一篇:Python 基礎 - if else流程判斷


下一篇:根据TxID获取上链数据