0

Before Android5.0,I use DexClassloader load plugin dynamiclly,code like this:

DexClassLoader localDexClassLoader = new DexClassLoader(pluginSrcJarDir,cont.getDir("dex", 0).getAbsolutePath(), null, ClassLoader.getSystemClassLoader().getParent());

Class<?> pluginClass = localDexClassLoader.loadClass(className);  //error here 

but on Android5.0 here is the error:

04-03 05:51:42.743: W/(1462): Zip: 792 extraneous bytes at the end of the central directory 04-03 05:51:42.749: W/System.err(1462): java.lang.ClassNotFoundException: Didn't find class "com.garfield.item0.system.plugin01.AckGetIntroduce" on path: DexPathList[[zip file "/data/data/com.garfield/cache/1428040302214.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] 04-03 05:51:42.811: W/System.err(1462): Suppressed: java.io.IOException: Failed to open zip archive '/data/data/com.garfield/cache/1428040302214.jar' 04-03 05:51:42.820: W/System.err(1462): at dalvik.system.DexFile.openDexFileNative(Native Method) 04-03 05:51:42.820: W/System.err(1462): at dalvik.system.DexFile.openDexFile(DexFile.java:295) 04-03 05:51:42.821: W/System.err(1462): at dalvik.system.DexFile.(DexFile.java:111) 04-03 05:51:42.821: W/System.err(1462): at dalvik.system.DexFile.loadDex(DexFile.java:151) 04-03 05:51:42.821: W/System.err(1462): at dalvik.system.DexPathList.loadDexFile(DexPathList.java:265)

why?please help me!before 5.0 it is ok。what happened on 5.0!

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Yin22
  • 1
  • 1

1 Answers1

0

From Android 5.0 on, the JVM on which Android runs on is ART but not Dalvik anymore. And look at your logcat trace:

dalvik.system.DexPathList.loadDexFile

your codes still tried to run Dalvik things.

SilentKnight
  • 13,761
  • 19
  • 49
  • 78