Overview
Hunter is a framework designed to develop Android Gradle plugins using ASM and Gradle Transform API. It offers a range of scalable plugins for Android developers, allowing them to monitor their app, enhance 3rd-party dependencies, and improve the Android framework. Hunter’s plugins support incremental and concurrent compilation, minimizing additional build time. The latest version of Hunter has been published to MavenCentral.
Features
- OkHttp-Plugin: Allows you to hack OkHttp and set a global Interceptor/Eventlistener/Dns for all OkhttpClients, even those in 3rd-party libraries.
- Timing-Plugin: Enables you to time all your UI-thread methods and dump block traces with the costed time of every step. You can also consume the block detail in your preferred way.
- Debug-Plugin: Allows you to easily add an annotation to a specific method, which will then print all parameters, costed time, and return value. This plugin offers advantages over Jake Wharton’s hugo.
- LogLine-Plugin: Adds a line number to every line of your logcat.
Installation
To install the Hunter framework and its plugins, follow these steps:
- Add the following code to your project’s
build.gradlefile:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.quinn.hunter:hunter-transform:latest_version'
}
}
apply plugin: 'hunter'
Replace
latest_versionin the code snippet above with the actual latest version of Hunter.Add the desired plugins to your project’s
build.gradlefile under thehunterblock. For example:
hunter {
plugins {
okhttp_plugin()
timing_plugin()
debug_plugin()
logline_plugin()
}
}
- Build your project using Gradle.
Summary
Hunter is a powerful framework for developing Android Gradle plugins. It offers a range of plugins that allow developers to enhance their apps, 3rd-party dependencies, and the Android framework itself. With features like timing, debugging, and log line enhancements, Hunter provides useful tools for monitoring and optimizing Android applications.