explaingit

tiann/epic

4,544JavaAudience · developerComplexity · 3/5Setup · moderate

TLDR

An Android library that lets you intercept and modify any Java method at runtime, before it runs, after it runs, or instead of it, without changing the original source code, supporting Android 5.0 through 11 on ARM devices.

Mindmap

mindmap
  root((Epic AOP))
    What it does
      Intercept methods
      Modify runtime behavior
    How it works
      Before or after hooks
      Replace method body
    Limitations
      ARM devices only
      No emulator support
    Use cases
      Performance monitoring
      Security auditing
      Logging
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add logging or performance tracking to any method in your Android app without modifying the original code.

USE CASE 2

Audit your Android app for calls to sensitive APIs by intercepting them at runtime for security reviews.

USE CASE 3

Hook into Android system methods to observe or change their behavior without rooting the device.

USE CASE 4

Replace error handling in a third-party library at runtime when you cannot modify its source code.

Tech stack

JavaAndroidART

Getting it running

Difficulty · moderate Time to first run · 30min

Only works on real ARM Android devices (thumb2/ARM64) running Android 5.0, 11, does not work on emulators or x86 hardware.

In plain English

Epic is a library for Android developers that lets you intercept and modify the behavior of Java methods at runtime, without changing the original source code of those methods. This technique is called AOP, short for Aspect-Oriented Programming, which is a way of adding behavior to existing code from the outside rather than editing it directly. The library is a continuation of an earlier project called Dexposed, which was originally built by Alibaba. Dexposed stopped working on newer versions of Android when Google replaced the older Dalvik runtime with a new one called ART. Epic picks up where Dexposed left off and adds support for ART, covering Android versions 5.0 through 11. The way it works is straightforward from a developer's perspective. You pick a method in any Java class, including Android system classes running inside your app, and tell Epic to run your own code before it, after it, or instead of it. The library handles the low-level work of redirecting method calls at the processor instruction level. Integration requires adding one line to your project's build file and loading a small native library when your app starts. Typical use cases listed in the README include monitoring what your app is doing at runtime (useful for testing and measuring performance), checking for calls to sensitive APIs for security audits, and general AOP patterns such as adding logging or error tracking without modifying every method individually. There are some limitations to be aware of. The library only works on real Android devices using ARM processors (thumb2 and ARM64 instruction sets). It does not work on Android emulators or on x86 hardware. Very short methods that compile down to fewer than a certain number of processor instructions are also not supported because there is not enough space to insert the redirection. Epic is open source and welcomes bug reports and pull requests.

Copy-paste prompts

Prompt 1
Using the Epic AOP library on Android, show me how to intercept a specific method and log its arguments before it runs.
Prompt 2
I want to use Epic to hook into an Android system API call and replace its return value, write the Java code to do this.
Prompt 3
Help me add Epic to my Android project's build file and initialize the native library at app startup.
Prompt 4
Using Epic, add runtime monitoring to all network calls in my Android app to measure response latency.
Open on GitHub → Explain another repo

← tiann on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.