In Java, the default system ClassLoader can be replaced using:
java -Djava.system.class.loader=com.test.MyClassLoader xxx
This way, the custom ClassLoader is used to load new classes, while having the default system ClassLoader as its parent.
Can the same system ClassLoader replacement be done in an Android application using a non-runtime method? (gradle/manifest or some other compilation flag)
I am not looking to replace the system ClassLoader at runtime, but set a different system ClassLoader to the whole application as it starts, before even the Application class is loaded.
The end goal is to run code before even the Application class's <clinit>
is called (this would essentially allow me to load all classes in the application as I see fit).