0

Before Android5.0,I use DexClassloader load plugin dynamiclly,code like this:</p>

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:</p>

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!</p>

4

1 回答 1

0

从 Android 5.0 开始,JVMAndroid 运行的平台ART不再是Dalvik。并查看您的 logcat 跟踪:

dalvik.system.DexPathList.loadDexFile

你的代码仍然试图运行的Dalvik东西。

于 2015-04-03T06:16:02.960 回答