(Android) Transformers - bytecode in disguise!
summary
Firebase Performance Monitoring uses build‑time bytecode rewriting to intercept HTTP calls: a Gradle plugin hooks the Android Transform API, an ASM-based transformer scans class files, replaces specific invokevirtual calls (e.g. invokevirtual→invokestatic) and redirects them to a companion runtime. The static helper wraps URLConnection and InputStream with decorators that time and measure traffic. The implementation is open as a sample, supports incremental builds, and the approach proves practical (used in production for Firebase monitoring).
AI-written summary · about
chapters (9)
- 0:00Start
- 3:08How can you build a no-code HTTP data collector SDK?
- 10:55Transform Gradle plugin - MyTransform class
- 12:22Transforminvocation interface - defines inputs and ouputs
- 15:33But first, a little bit about the JVM
- 20:31Instrumentation Visitor skeleton
- 23:30javap -c verbose SomeClass.class (3)
- 27:08Bytecode change-one weird trick
- 32:41Tips for transforms
related talks
34m(Android) Transformers - Bytecode in Disguise!
42m(Android) Transformers — Bytecode in Disguise!
39mBytecode Transformations: Exploring new AGP APIs for instrumenting your app
40mIntroduction to Bytecode Instrumentation with AGP 8
38mArtifact Transforms
26mBuild-Time Auto-Instrumentation in Android
33mIMPROVING ANDROID BUILD PERFORMANCE
45mImpact of Framework Choice on your Application: A Reverse Engineering Perspective
