• 设备
    • 今日
    • 0

    Battery Historian for windows环境搭建

    Battery Historian for windows环境搭建
    简介:Battery historian是一款通过上传bugreport文件分析用户手机中App的电池耗电情况的工具。
    Battery Historian 1.0 通过python脚本转换成html文件,而新版本 Battery Historian 2.0 发布了,新版本带来了很多的改进:更清晰的报告,每个应用程序的摘要,更快的执行等等。
    步骤

    一、首先安装Go编程语言
    点击下载【下载】;https://dl.gocn.io/  go1.9.2.windows-amd64.msi
    安装Go;
    配置GOROOT和GOPATH
    a. GOROOT的作用是告诉Go 命令和其他相关工具,在哪里去找到安装在你系统上的Go包,所以这里配置的是GO的安装目录
    GOROOT: D:\Go\
    b.GOPATH可以简单理解为是工程的目录,所以创建一个GO的工程路径
    GOPATH D:\Go\Workspace
    C.最后配置一下环境变量,把Go的bin目录放到path环境变量中
    D:\Go\bin 放到path环境
    4. 检查Go是否安装成功,打开命令行输入Go version
    go version go1.9.2 windows/amd64

    二、安装Git
    点击下载【下载】;
    翻墙下载:  https://github-production-release-asset-2e65be.s3.amazonaws.com/23216272/72b6ebce-0c49-11e8-8b24-4645465eceb6?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20180209%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180209T024344Z&X-Amz-Expires=300&X-Amz-Signature=92d08c6539165d220b6f95852cfa317b4144f4f977c5dc134dbceb22d9a99ee8&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DGit-2.16.1.4-64-bit.exe&response-content-type=application%2Foctet-strea
    按照步骤安装;
    安装完成检查:命令行输入git version
    git version 2.16.1.windows.4
    也可以直接打开git bash检查
    $ git version
    git version 2.16.1.windows.4

    三、安装Python
    点击下载【下载】,注意仅支持python2.7
    https://www.python.org/ftp/python/2.7.14/python-2.7.14.amd64.msi
    安装完成;
    环境变量配置,添加Path的路径,是Python的安装路径
    输入命令行 python –V(注意是大写V)检查是否安装成功
    Python 2.7.14  

    四、安装Java环境
    点击下载【下载】;
    完成安装。

    五、下载Battery Historian源码并且运行
    输入命令行go get -d -u github.com/google/battery-historian/...
    **下载到GOPATH配置目录下
    进入到$GOPATH/src/github.com/google/battery-historian目录下方
    cd $GOPATH/src/github.com/google/battery-historian
    运行Battery Historian
    a. go run setup.go
    # Compile Javascript files using the Closure compiler
    $ go run setup.go
    等待10分钟左右,即可安装成功(如果仍然没有下载成功,可以手动下载,如下操作)
    Downloading Closure library...
    Downloading Closure compiler...
    Downloading 3rd-party JS files...
    Generating JS runfiles...
    Generating optimized JS runfiles...
    jimmy@win10 MINGW64 /d/Go/Workspace/src/github.com/google/battery-historian (master)
    **下载【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)
    $ cd /d/go/Workspace/src/github.com/google/battery-historian/
    $ go run cmd/battery-historian/battery-historian.go
    2018/02/09 11:12:50 Listening on port:  9999
    2018/02/09 17:06:19 Trace starting analysisServer processing for: GET
    2018/02/09 17:06:19 Trace finished analysisServer processing for: GET
    检查/battery-historian是否运行,登录网址 http://localhost:9999查看
    Upload Bugreport
    Both .txt and .zip bug reports are accepted.
    .......

    六、导出手机的Bugreport日志
    ADB不识别device not found解决办法:error: device not found
    查找adb.exe所在androidSDK的目录:
    where adb.exe
    显示:D:\tools\eclipse\Android-sdk\platform-tools\adb.exe 说明adb.exe才是正确的安装路径,若在c:\windows是不正确的。则:
    在变量值里加入androidSDK中platform-tools和tools的目录路径
    在path中,加入: 
    1. D:\tools\eclipse\Android-sdk\tools
    2. D:\tools\eclipse\Android-sdk\platform-tools
    最后在CMD模式下: SET PATH=C:\   关闭CMD,重新打开CMD,输入:PATH,使新path变量生效。
    1.CMD输入指令 
    cd d:\temp 
    adb bugreport > bugreport.txt导出。
    生成以下两个文件:
    bugreport.txt
    bugreport-NMF26X-2018-02-09-16-13-35.zip
    ...........
    在设备管理器中,找到Android Composite ADB Interface 然后双击点开
    然后在详细信息中,点开硬件ID,查看到我的ID是2D95,如下图:
    已配置设备 USB\VID_2D95&PID_6003&MI_01\6&3511f3ea&0&0001 
    在C:\Documents and Settings\Administrator\.android目录下找到或新建一个adb_usb.ini文件,
    然后把VID的数值写入到adb_usb.ini 里面,就是0xVID(0x2D95)
    还是不行:
    在电脑中找到android开发下载的sdk目录(假设你已经通过sdk manager下载了),进入\extras\google\usb_driver文件夹下
    32:[Google.NTx86]
    64:[Google.NTamd64]
    这里我们只需要仿照这种文件的格式,复制这些驱动信息,并用驱动设备中获取的2D95和6003来修改,如下:

    七、上传bugreport.txt文件至 http://localhost:9999
    上传bug日志
    注:必须在翻墙状态下,选择文件后的submit才能看并点击提交文件。
    查看结果

    来自:PC 美国
    上一篇: Windows 自动关机
    您可能还喜欢这些:

    亲,沙发正空着,还不快来抢?

    评论审核已开启:即评论经审核才能正常显示! 记住我的个人信息 回复后邮件通知我