A tool for discovering high-time-consuming methods for Android App.Used to quickly find high-time-consuming methods, locate and solve Android App jank problem. Through gradle plugin + ASM, instrumentation of all methods during compilation, and provide friendly interface display in browser, support time-consuming filtering, thread filtering, method name filtering, etc.
- Method time-consuming data collection part
- Method time-consuming data display part
- AndroidStduio auxiliary plugin
buildscript {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "gradle.plugin.cn.cxzheng.methodTracePlugin:tracemanplugin:1.0.4"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://plugins.gradle.org/m2/" }
}
}
dependencies {
debugImplementation 'com.github.zhengcx:MethodTraceMan:1.0.7'
releaseImplementation 'com.github.zhengcx:MethodTraceMan:1.0.5-noop'
}
apply plugin: "cn.cxzheng.asmtraceman"
traceMan {
open = true
traceConfigFile = "${project.projectDir}/traceconfig.txt"
}
Configuration code instrumentation range,example:
#config the package need to trace,If they are empty, all files are traced by default.
-tracepackage cn/cxzheng/asmtraceman
#Setting up traceless packages under packages that require trace
-keeppackage cn/cxzheng/asmtraceman/test
#Setting up traceless classes under packages that require trace
-keepclass cn/cxzheng/asmtraceman/MainActivity
#Fixed configuration here: cn/cxzheng/tracemanui/TraceMan
-beatclass cn/cxzheng/tracemanui/TraceMan
The main function of this plugin is to quickly and easily open the UI display interface of methodtraceman.This plugin has been uploaded to Android Stduio plug-in repository. You can search forMethodTraceMan
to install it. How to install Android Stduio plug-in is not detailed here, but you can search online.After installed plugin and restart AndroidStduio, you can see the yellow light bulb icon of the MethodTraceMan plugin in the top bar.
After completing the above two steps, make sure you have completed:
- Rebuild&Run launches your app after integration as required.
- MethodTraceMan plugin is installed on AndroidStduio.
Next, we'll show you how to use MethodTraceMan to easily troubleshoot time-consuming methods:
2.After launching the app, click on the MethodTraceMan light bulb icon in the top bar of AndroidStduio, and the UI of MethodTraceMan will be opened in the browser as follows:
4.After operating the app, click the “End method time-consuming statistics” button, and the time-consuming statistics of all methods will be output. You can perform time-consuming filtering, thread filtering, method name search, etc. for screening.
Apache2.0.