Skip to content

0x00 QuickStart_en

hui.zhao edited this page Dec 15, 2019 · 21 revisions

QuickStart

Step1 Dependencies

build.gradle of Module project

dependencies {
    // Core module
    implementation 'cn.hikyson.godeye:godeye-core:VERSION_NAME'
    // Debug dashboard
    debugImplementation 'cn.hikyson.godeye:godeye-monitor:VERSION_NAME'
    // Release no dashboard
    releaseImplementation 'cn.hikyson.godeye:godeye-monitor-no-op:VERSION_NAME'
    // Extra module, help to monitor network
    implementation 'cn.hikyson.godeye:godeye-okhttp:VERSION_NAME'
    // Extra module, help to monitor crash/ANR
    implementation 'cn.hikyson.godeye:godeye-xcrash:VERSION_NAME'
}

VERSION_NAME Github release

[Optional] Support MethodCanary(A tool to monitor method time consuming)

build.gradle of Root Project:

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

PLUGIN_VERSION_NAME MethodCanary github release

build.gradle of Application Module Project('com.android.application'):

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

Create js file MethodCanary.js in project root directory to config MethodCanary, sample:

/**
    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'))
}

How to config MethodCanary.js

Step2 Initialize And Install Modules

GodEye class is entrance for this step, almost all apis are provided by it.

Init first in your application:

GodEye.instance().init(this);

Install modules in application onCreate, Repeated calls of this method will install modules that have not been installed.

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

There are several ways to build GodEyeConfig

  1. (General usage)Install from XML type assets directory:GodEyeConfig.fromAssets("assets path")
  2. Install from XML type InputStream:GodEyeConfig.fromInputStream(InputStream)
  3. Default configuration:GodEyeConfig.defaultConfig()

XML Sample:install.config

[Optional] Uninstall Modules

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

GodEye.instance().uninstall();

Step3 Install Performance Visualization Dashboard

GodEyeMonitor class is entrance for this step.

Start performance visualization dashboard:

GodEyeMonitor.work(context)

[Optional] Stop it

GodEyeMonitor.shutDown()

Apply AndroidGodEye for Release

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.

android_god_eye_plugin

You can open it by sh/bat script without installing the plug-in

Modify port when port conflict

Now enjoy it!

Clone this wiki locally