mercredi 23 décembre 2015

Loading Fragments using reflection causes "java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation"

I am developing android Enterprise application where i want to use some file on run-time.I am able to use simple class using Java Reflection and i also want to use Fragment.

E.g.- I have created TestingDummyJar.jar and placed in SDCard.
Usage - First I am loading this jar using DexClassLoader and then loading class. its working perfectly for Simple class as -

final File tmpDir = this.getDir("dex", 0);
classloader = new DexClassLoader("/SDcard/TestingDummyJar.jar", tmpDir.getAbsolutePath(), null, this.getClassLoader());
mLoadedClass = (Class) classloader.loadClass("com.example.testingdummyjar.ScrollerCustomDuration");

But when i try to load Fragment as-
mLoadedClass = (Class) classloader.loadClass("com.example.testingdummyjar.ScrollerCustomDuration");

throw Exception "java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation"





Aucun commentaire:

Enregistrer un commentaire