-
Notifications
You must be signed in to change notification settings - Fork 344
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. Version 3.1.2 usage reference: QuickStart_3.1.2_legacy_en
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'
// From Version 3.4.0, godeye-monitor-no-op has been removed.
// 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
debugImplementation 'cn.hikyson.godeye:godeye-leakcanary:VERSION_NAME'
}
VERSION_NAME Github release
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'
AndroidGodEye {
enableMethodTracer true // Need method monitor, Attention, close it when in production, e.g: !gradle.startParameter.taskNames.contains("assembleRelease")
enableLifecycleTracer true // need page lifecycle method monitor
instrumentationRuleFilePath 'AndroidGodEye-MethodCanary.js'
instrumentationRuleIncludeClassNamePrefix(['cn/hikyson/godeyedemo'])
}
Change instrumentationRuleIncludeClassNamePrefix
to your app package name you want to monitor
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
You can change config of AndroidGodEye like this:
buildTypes {
release {
resValue("bool", "android_god_eye_manual_install", "false")
resValue("bool", "android_god_eye_need_notification", "false")
resValue("integer", "android_god_eye_monitor_port", "5390")
resValue("string", "android_god_eye_install_assets_path", "android-godeye-config/install.config")
}
debug {
resValue("bool", "android_god_eye_manual_install", "false")
resValue("bool", "android_god_eye_need_notification", "true")
resValue("integer", "android_god_eye_monitor_port", "5390")
resValue("string", "android_god_eye_install_assets_path", "android-godeye-config/install.config")
}
}
Then add the android-godeye-config/install.config
file to your project's assets directory, which is used to describe all the module configurations that need to be installed, as in the Sample project: install.config
If you want to install manual, specify
android_god_eye_manual_install
totrue
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!
Note: Connect android device and pc with USB, then open developer mode and allow debug by USB
Version below 3.4.0 need more steps QuickStart_3.3.x