assets/src/org/ruboto/FrameworkHack.java in ruboto-1.3.1 vs assets/src/org/ruboto/FrameworkHack.java in ruboto-1.4.0

- old
+ new

@@ -24,10 +24,11 @@ import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import java.util.zip.ZipFile; /** * Collection of dirty codes. don't tell android team this mess. * @author Alan Goo @@ -112,11 +113,11 @@ } // https://android.googlesource.com/platform/libcore/+/master/libdvm/src/main/java/dalvik/system/BaseDexClassLoader.java // https://android.googlesource.com/platform/libcore/+/master/dalvik/src/main/java/dalvik/system/BaseDexClassLoader.java public static void appendDexListImplICS(ArrayList<File> jarFiles, PathClassLoader pcl, File optDir, - boolean kitkatPlus) throws Exception { + boolean kitkatPlus, boolean marshmallowPlus) throws Exception { if(debug) { Log.d(TAG, "appendDexListImplICS(" + jarFiles); } // to save original values Class bdclClass = Class.forName("dalvik.system.BaseDexClassLoader"); @@ -137,11 +138,14 @@ Class clazzElement = Class.forName("dalvik.system.DexPathList$Element"); // create new merged array int jarCount = jarFiles.size(); Object newDexElemArray = Array.newInstance(clazzElement, orgDexCount + jarCount); System.arraycopy(objOrgDexElements, 0, newDexElemArray, 0, orgDexCount); - Method mMakeDexElements = null; - if (kitkatPlus) { + final Method mMakeDexElements; + if (marshmallowPlus) { + mMakeDexElements = + dplClass.getDeclaredMethod("makePathElements", List.class, File.class, List.class); + } else if (kitkatPlus) { mMakeDexElements = dplClass.getDeclaredMethod("makeDexElements", ArrayList.class, File.class, ArrayList.class); } else { mMakeDexElements = dplClass.getDeclaredMethod("makeDexElements", ArrayList.class, File.class); }