This project demonstrates different methods of loading and executing DEX files in Android, with a focus on dynamic loading techniques such as DexClassLoader, PathClassLoader, and in-memory execution.
- Dex Loader: Loads and executes
contacts.dex, which simulates reading device contacts. - PathClassLoader / In-Memory Dex Loader: Load
classes.dex, which contains a simple method that generates a random number and displays it on screen.- The In-Memory Dex Loader simulates fetching the dex file from a remote server before executing it.
DexClassLoaderusage is restricted on Android 10 and above. The demo may not function properly on newer devices due to scoped storage and runtime execution limitations.
The app requests the READ_CONTACTS permission because the contacts.dex file simulates accessing the user's contact list.
contacts.dexis executed through DexClassLoader and prints contact data to logcat.classes.dexis used in both PathClassLoader and In-Memory loaders to generate a random number, which is shown in the UI.- The In-Memory Dex Loader simulates downloading and executing a dex file directly from memory, without saving it to disk.
This project is intended for educational and research purposes only.
Do not use it for malicious, unethical, or illegal activities.
The author takes no responsibility for any misuse or damage caused.