Terrible reflection hacks around classloaders in Android. Sample app from a talk given at Droidcon NYC 2018.
Slides: https://speakerdeck.com/gdglviv/zac-sweers-breaking-the-android-classloader
Core project is blackmirror
, which has the BlackMirror
classloader implementation and some other utilities for working with classloaders and dex files
Examples:
app
- The main sample appneighbor
- A simple sibling app with some simple code, used as the target for the main app to run code out of.initprovider:simple
- demonstrating automatic initialization via init provider (beforeApplication#onCreate()
)initprovider:pluginized
- demonstrating automatic initialization via pluginized init provider (beforeApplication#onCreate()
)samples:logging
- Simple logging of class loading via Timbersamples:timing
- Simple timing of class loading, reported via Timbersamples:swapper
- Different examples of trying to swap what classes are loaded. Does not work for different reasonssamples:hello
- SimpleHello
interface with asayHello
method. Used in the next two samplessamples:assets
- Example loading dex files from assets, in this caseHello
implssamples:resources
- Example loading dex files from resources, in this caseHello
implssamples:spy
- Examples for reading other apps' dex files and running other apps' code