Skip to content

0x00a QuickStart_3.1.2_legacy_en

AndroidKy edited this page May 27, 2020 · 3 revisions

QuickStart-Version3.1.2-No androidx

You can refer to demo project: legacy-3.1.2

Step1 Dependencies

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

Root Project build.gradle

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

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

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 like:

<config>
    <cpu intervalMillis="2000"/>
    <battery />
    <fps intervalMillis="2000"/>
    <leakMemory debug="true" debugNotification="true" leakRefInfoProvider="cn.hikyson.godeye.core.internal.modules.leakdetector.DefaultLeakRefInfoProvider"/>
    <heap intervalMillis="2000"/>
    <pss intervalMillis="2000"/>
    <ram intervalMillis="2000"/>
    <network />
    <sm debugNotification="true"
        dumpIntervalMillis="1000"
        longBlockThresholdMillis="500"
        shortBlockThresholdMillis="500"/>
    <startup />
    <traffic intervalMillis="2000" sampleMillis="1000"/>
    <crash immediate="false"/>
    <thread intervalMillis="3000"
        threadFilter="cn.hikyson.godeye.core.internal.modules.thread.ExcludeSystemThreadFilter"/>
    <pageload pageInfoProvider="cn.hikyson.godeye.core.internal.modules.pageload.DefaultPageInfoProvider"/>
    <methodCanary maxMethodCountSingleThreadByCost="300" lowCostMethodThresholdMillis="10"/>
    <appSize delayMillis="0"/>
    <viewCanary maxDepth="10"/>
</config>

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.

Now enjoy it!

Clone this wiki locally