AndroidGodEye

Additional

Language
Java
Version
N/A
Created
Nov 23, 2017
Updated
Dec 2, 2019
Owner
AndroidKy (Kyson)
Contributors
AndroidKy (Kyson)
codacy-badger
ImgBotApp
ahhbzyz
4
Activity
Badge
Generate
Download
Source code
APK file

Announcement

Quickstart

Demo APK

Demo Project:https://github.com/Kyson/AndroidGodEyeDemo

Step1 Dependencies

Module Project build.gradle

dependencies {
  implementation 'cn.hikyson.godeye:godeye-core:VERSION_NAME'
  debugImplementation 'cn.hikyson.godeye:godeye-monitor:VERSION_NAME'
  releaseImplementation 'cn.hikyson.godeye:godeye-monitor-no-op:VERSION_NAME'
  implementation 'cn.hikyson.godeye:godeye-toolbox:VERSION_NAME'
}

Find VERSION_NAME in Github release

Root Project build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "cn.hikyson.methodcanary:plugin:PLUGIN_VERSION_NAME"
    }
}

Find PLUGIN_VERSION_NAME in MethodCanary github release

You need to config the logic of method canary injection, create js file:MethodCanary.js in project root dir, content like following:

/**
    classInfo
        {int access
         String name
         String superName
         String[] interfaces}

     methodInfo
         {int access
         String name
         String desc}
**/
function isExclude(classInfo,methodInfo){
    return false
}

function isInclude(classInfo,methodInfo){
    return classInfo.name.startsWith('cn/hikyson/godeyedemo'))
}

More configurations reference: MethodCanary

Module Project 'com.android.application' build.gradle

apply plugin: 'cn.hikyson.methodcanary.plugin'

Step2 Initialize And Install Modules

Init first in your application:

GodEye.instance().init(this);

Install modules in application onCreate, GodEye class is entrance for this step, all modules are provided by it.

if (ProcessUtils.isMainProcess(this)) {//install in main process
    GodEye.instance().install(GodEyeConfig.fromAssets("<config path>"));
}

"<config path>" is assets path of config, content reference: install.config

Optional Uninstall Modules

Uninstall modules when you don't need it(not recommend):

GodEye.instance().uninstall();

Note that network and startup module don't need install and uninstall.

When install finished, GodEye begin produce performance data, generally you can call consume of modules to get these datas, for example:

GodEye.instance().<Cpu>getModule(GodEye.ModuleName.CPU).subject().subscribe()

Just like we will mention later,Debug Monitor is one of these consumers.

Step3 Install Performance Visualization Dashboard

GodEyeMonitor class is entrance for this step.

Start performance visualization dashboard:

GodEyeMonitor.work(context)

Stop it:

GodEyeMonitor.shutDown()

Install IDE Plugin

Install Android Studio plug-in(Search AndroidGodEye in Android Studio plugin setting),Then you can find AndroidGodEye in main toolbar,click it and it will open dashboard in browser.

Connect mobile phones and computers with USB, run adb forward tcp:5390 tcp:5390, then open http://localhost:port/index.html(Note that /index.html is necessary!!!) on PC. If you don't have a USB, you can also open http://mobile ip:port/index.html directly, ensure that mobile phones and PC are in the same LAN segment of course.

Default port is 5390, you can find ip in logcat output after call GodEyeMonitor.work(context,port), log is like:'Open AndroidGodEye dashboard [ http://ip:port/index.html" ] in your browser...'.

Now enjoy it!

Performance Visualization Dashboard

Click ↓ to preview

MethodCanary

Fps/RAM/PSS/Battery...

Cpu/Heap/Traffic...

Leak Memory/App Jank(Block)

Leak Memory GIF

Jank(Block) GIF

Page Lifecycle(Page Load)/Network

Page Lifecycle(Page Load) GIF

Network GIF

Network Detail

Thread

Framework

How does AndroidGodEye work?As below:

License

AndroidGodEye is under Apache2.0.

Contributors

About Me