1. 背景
测试了最近测试提供的Bugreport文件
- 使用 Window的 Go 无法解析
- 使用Ubuntu使用 Docker,正常解析
备注:
- Window的 Go 运行源码 battery-historian,存在无法解析一些Bugreport文件,可能是源码的代码没有更新维护了,所以使用 Docker 加载最新版本的battery-historian可以取到最新代码
- Ubuntu使用battery-historian需要翻墙,翻墙可以使用手机连接到公司的翻墙WiFi,然后再使用“USB共享网络”的功能分享给ubuntu电脑即可
实测可行,并且可以正常解析之前window无法解析的Bugreport文件了
2. 安装 Docker
2.1 Ubuntu 安装docker可以参考
我自己整理了下脚本,具体参见如下
https://blog.csdn.net/su749520/article/details/102959712
2.2 Window 安装docker可以参考
Window 上使用Docker 参考如下文档如下,配置上比Ubuntu麻烦很多就是,遇到问题就百度即可:
https://www.jianshu.com/p/e8427d12b3e0
2.3 安装后显示如下小鲸鱼图片
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com
Start interactive shell
注意记住这个ip地址“192.168.99.100”哦
3. Docker 加载镜像启动battery-historian工具
下面是目前比较新的 android-battery-historian 镜像,注意下载需要翻墙VPN
docker run -p 9999:9999 gcr.io/android-battery-historian/stable:3.0 --port 9999
一些常用命令如下
// Ubuntu
sudo docker run -p 9999:9999 gcr.io/android-battery-historian/stable:3.0 --port 9999
// Window 不需要 sudo 命令
docker run -p 9000:9999 registry.cn-hangzhou.aliyuncs.com/xyz10/android-battery-historian:stable-3.0
// 停止 docer 服务
sudo service docker stop
// 启动 docer 服务
sudo service docker start
命令运行结果大概如下:
$ docker run -p 9999:9999 gcr.io/android-battery-historian/stable:3.0 --port 9999
Unable to find image 'gcr.io/android-battery-historian/stable:3.0' locally
3.0: Pulling from android-battery-historian/stable
f7277927d38a: Pull complete
8d3eac894db4: Pull complete
edf72af6d627: Pull complete
3e4f86211d23: Pull complete
ac5d6e8f41a3: Pull complete
89e1cca7c291: Pull complete
1c6b579f97fc: Pull complete
a73d3370a7dc: Pull complete
52c70f621a64: Pull complete
4687e759f67f: Pull complete
7f056f369588: Pull complete
62683cf72ae5: Pull complete
Digest: sha256:7711d28f2d95b6858688acd52350fa5fd420c4a5114e670b559d77cfe37f90f2
Status: Downloaded newer image for gcr.io/android-battery-historian/stable:3.0
2019/11/08 06:39:16 Listening on port: 9999
慢慢等待上述下载完成就行
4. 解析 BugReport 文件
4.1 Ubuntu
浏览器输入即可
http://localhost:9999/ 或 http://127.0.0.1:9999/
4.2 Window 10
使用docker提示的IP地址
docker is configured to use the default machine with IP 192.168.99.100
浏览器输入
http://192.168.99.100:9999/