-
Notifications
You must be signed in to change notification settings - Fork 344
0x00a QuickStart_3.1.2_legacy_en
AndroidKy edited this page May 27, 2020
·
3 revisions
You can refer to demo project: legacy-3.1.2
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'
}
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')
}
apply plugin: 'cn.hikyson.methodcanary.plugin'
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>
GodEyeMonitor class is entrance for this step.
Start performance visualization dashboard:
GodEyeMonitor.work(context)
Stop it:
GodEyeMonitor.shutDown()
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!