diff --git a/Android/DevSample/small/src/main/java/net/wequick/small/util/ReflectAccelerator.java b/Android/DevSample/small/src/main/java/net/wequick/small/util/ReflectAccelerator.java index a771d19a..922ee4ad 100644 --- a/Android/DevSample/small/src/main/java/net/wequick/small/util/ReflectAccelerator.java +++ b/Android/DevSample/small/src/main/java/net/wequick/small/util/ReflectAccelerator.java @@ -184,7 +184,11 @@ private static Object makeDexElement(File pkg, boolean isDirectory, DexFile dexF sDexElementClass = Class.forName("dalvik.system.DexPathList$Element"); } if (sDexElementConstructor == null) { - sDexElementConstructor = sDexElementClass.getConstructors()[0]; + if (Build.VERSION.SDK_INT >= 26) { + sDexElementConstructor = sDexElementClass.getConstructors()[1]; // (DexFile, File) + } else { + sDexElementConstructor = sDexElementClass.getConstructors()[0]; + } } Class[] types = sDexElementConstructor.getParameterTypes(); switch (types.length) { @@ -207,10 +211,10 @@ private static Object makeDexElement(File pkg, boolean isDirectory, DexFile dexF // Element(File apk, File zip, DexFile dex) return sDexElementConstructor.newInstance(pkg, pkg, dexFile); } - case 1: + case 2: if (Build.VERSION.SDK_INT >= 26) { //Only SDK >= 26 - return sDexElementConstructor.newInstance(dexFile); + return sDexElementConstructor.newInstance(dexFile, pkg); } case 4: default: