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 |
Latest published artifact: io.github.gracker:TraceFix:0.1.0
Maven Central repository: https://repo1.maven.org/maven2/io/github/gracker/TraceFix/0.1.0/
- Set plugin version in
gradle.properties:
TRACEFIX_VERSION=0.1.0- 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).
- Configure Central Portal token credentials (choose one source):
- Environment variables:
export OSSRH_USERNAME=... # token username from https://central.sonatype.com/usertoken
export OSSRH_PASSWORD=... # token password from https://central.sonatype.com/usertoken- Or root
local.properties:
ossrhUsername=...
ossrhPassword=...- Configure signing (choose one source):
- In-memory key:
export SIGNING_KEY='-----BEGIN PGP PRIVATE KEY BLOCK-----...'
export SIGNING_PASSWORD=...
export SIGNING_KEY_ID=... # optional- Gradle legacy signing properties (
~/.gradle/gradle.propertiesorlocal.properties):
signing.keyId=...
signing.password=...
signing.secretKeyRingFile=/path/to/secring.gpg- Or use system GPG:
useGpgCmd=true- Confirm namespace (optional when it equals
publishedGroupId):
export TRACEFIX_CENTRAL_NAMESPACE=io.github.gracker- Verify publish configuration:
./gradlew :android-systrace-plugin:verifyReleasePublishConfig- Publish release artifact (latest flow):
./gradlew :android-systrace-plugin:publishReleaseToCentralCompatibility alias:
./gradlew :android-systrace-plugin:publishReleaseToSonatype- 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.