English README.md 中文 README_zh.md
TraceFix instruments bytecode at compile time and injects android.os.Trace.beginSection/endSection around methods.
| Your Goal | Choose | Use This |
|---|---|---|
| Integrate TraceFix into your app | Remote plugin (recommended) | "Remote Plugin" section |
| Develop or debug plugin in this repo | Local plugin (mavenLocal) |
"Local Plugin" section |
| Verify compatibility across AGP versions | 2x2 demo matrix | "Compatibility Verification" section |
- Set plugin version in
gradle.properties:
TRACEFIX_VERSION=0.0.6- Add plugin classpath in module or root
build.gradle:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("io.github.gracker:TraceFix:${TRACEFIX_VERSION}") { changing = true }
}
}- Apply plugin in app module:
apply plugin: 'auto-add-systrace'- Build your app and inspect traces in Perfetto (
https://ui.perfetto.dev/#!/viewer).
- Publish plugin to local Maven:
./gradlew :android-systrace-plugin:publishToMavenLocal- Use local demo modules:
- Low AGP local demo:
android-systrace-sample-local-debug - High AGP local demo:
android-systrace-sample-high-local-debug
Run full verification (low/high AGP x local/remote plugin):
LOW_AGP_VERSION=7.4.2 HIGH_AGP_VERSION=8.3.2 ./scripts/verify-compatibility.shChecks included:
Trace.beginSectionwas injected.Trace.endSectionwas injected.- Exception path is handled (
athrowpath exists in transformedtraceExceptionDemo).
| AGP | Local Plugin | Remote Plugin |
|---|---|---|
| 7.4.2 | android-systrace-sample-local-debug |
android-systrace-sample-low-remote-debug |
| 8.3.2 | android-systrace-sample-high-local-debug |
android-systrace-sample-remote-debug |
Notes for remote demo modules:
- Enable remote demo modules when syncing/building:
-PTRACEFIX_ENABLE_REMOTE_DEMOS=true- Provide remote artifact version and repository URL:
-PTRACEFIX_VERSION_REMOTE=1.0 -PTRACEFIX_REMOTE_REPO_URL=file://$PWD/build/tracefix-remote-repoTRACEFIX_AGP_VERSIONselects AGP used by this repo build.TRACEFIX_AGP_API_VERSIONselects plugin compile-timegradle-apidependency (defaults toTRACEFIX_AGP_VERSION, fallback7.4.2).- For pre-instrumentation-era AGP (Transform API only), keep a separate legacy branch/artifact.