Builds, infrastructure, CI, SDKs, bytecode
Bytecode Transformations: Exploring new AGP APIs for instrumenting your app
16:10 > 40 min
Sometimes you want to automate some boring tasks (for example, measuring the execution time of annotated methods or logging method calls with their arguments) or modify third-party dependencies in your own favor.
The Android Gradle plugin (AGP) has been providing Transform API for such cases, but it's proved to be inefficient and may be the cause of slow builds. The new API is much more efficient and easier to consume, so one can directly start modifying bytecode with almost zero-setup.
This talk will cover the new transform API, how it compares to the old one, touch a little bit on the JVM bytecode internals and show how this API can be useful for automating otherwise tedious or even impossible, from the source code perspective, tasks.
As an example, we'll try to turn all android Logcat logs into Timber logs (even the ones coming from third-party dependencies), to feed all log streams into a single source.