There is a interface IA
class in APK file. I create a jar containing IA's implementation MA
. The jar has a Global class
and B class
. The jar is loaded dynamically with Dexclassloader from data directory.
interface IA {
test();
}
class Global {
IA instance; //refer to MA instance.
}
class B {
....
instance.test() ; // throw NoSuchMethodError
....
}
But it's OK to call instance's test method through reflection.
Why? Surely I am not familiar with some principals of Classloader or DexClassloader. Could someone give explanation for me? Thanks