-
Notifications
You must be signed in to change notification settings - Fork 347
0x00 QuickStart_en
- Because AndroidGodEye use java8, so make sure your android projest support it.
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
- Secondly, because AndroidGodEye has been migrated to androidx since version 3.1.3, so your project needs to be migrated to androidx,if not in this case, use version 3.1.2 or below.
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'
// Extra module, help to monitor memory leak
implementation 'cn.hikyson.godeye:godeye-leakcanary:VERSION_NAME'
}
VERSION_NAME Github release, Migrated to androidx from Version 3.1.3, so if you don't use androidx, use version below 3.1.2
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 named AndroidGodEye-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 isInclude(classInfo,methodInfo){
return classInfo.name.startsWith('cn/hikyson/godeye/sample')
}
How to write AndroidGodEye-MethodCanary.js
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
- (General usage)Install from XML type assets directory:
GodEyeConfig.fromAssets("assets path")
- Install from XML type InputStream:
GodEyeConfig.fromInputStream(InputStream)
- Default configuration:
GodEyeConfig.defaultConfig()
XML Sample:install.config
Uninstall modules when you don't need it(not recommend):
GodEye.instance().uninstall();
GodEyeMonitor class is entrance for this step.
Start performance visualization dashboard:
GodEyeMonitor.work(context)
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.
You can open it by sh/bat script without installing the plug-in
Modify port when port conflict
Now enjoy it!