It takes about 2.1 minutes to read this article.

background

In the previous article “White Paper on APP Power Consumption Test”, I explained how to do APP power consumption test and its principle in detail. Today, I would like to share with you a problem I encountered in recent use: I could not submit bugreport file normally.

Before I get to that, let’s review how Android Battery Historian can be installed, as I did before using Docker:

                                    
                                    

Docker run --restart=always -d -p 9999:9999 gcr. IO /android-battery-historian/stable:3.0 --port 9999

Copy the code

The above command needs to climb over the wall to be installed normally. If there is no ability to climb over the wall, the following command can be executed, using the domestic mirror:

                                            
                                            

Docker run - restart = always - d - 9999 p: 9999 registry.cn-hangzhou.aliyuncs.com/xyz10/android-battery-historian:stable-3.0

Copy the code

The problem I’m talking about is that the page does not respond after submitting the bugreport file. Open the Chrome Console as follows:

The solution

According to Google, the d3.js library on this server has been removed 🤷♂️

Here we can use their own way to compile the source code to solve.

steps

Main Building of reference https://github.com/google/battery-historian from the source code to operate:

After installing and configuring the Go, Git, Python, and Java environments, you can execute the following compilation commands:

                                                                        
                                                                        

The following command took a long time to execute because of the speed of the network. I waited all afternoon to execute it

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

cd $GOPATH/src/github.com/google/battery-historian

The following command was also time-consuming, and I waited overnight to compile it

go run setup.go

Copy the code

However, the following error occurs when compiling:

Execute the following command:

                                                                                            
                                                                                            

cd third_party/closure-library/

git reset --hard v20170409

cd -

go run setup.go

Copy the code

There is no error, continue to follow the steps:

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

Copy the code

You should see the following state, indicating that it is ready to use:

Want to understand some sense, meet some interesting things — off the island