Hunter screenshot

Hunter

Author Avatar Theme by Leaking
Updated: 5 Aug 2022
1416 Stars

A fast, incremental, concurrent framework to develop compile plugin for android project to manipulate bytecode

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:

  1. Add the following code to your project’s build.gradle file:
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.quinn.hunter:hunter-transform:latest_version'
    }
}

apply plugin: 'hunter'
  1. Replace latest_version in the code snippet above with the actual latest version of Hunter.

  2. Add the desired plugins to your project’s build.gradle file under the hunter block. For example:

hunter {
    plugins {
        okhttp_plugin()
        timing_plugin()
        debug_plugin()
        logline_plugin()
    }
}
  1. 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.