private static void install(ClassLoader classLoader, File folder, boolean reverse) throws Throwable {
            Field pathListField = ReflectUtil.findField(classLoader, "pathList");
            Object dexPathList = pathListField.get(classLoader);

            Field nativeLibraryDirectories = ReflectUtil.findField(dexPathList, "nativeLibraryDirectories");

            List<File> libDirs = (List<File>) nativeLibraryDirectories.get(dexPathList);
            if (!reverse) {
                libDirs.add(0, folder);
            }
            Field systemNativeLibraryDirectories =
                    ReflectUtil.findField(dexPathList, "systemNativeLibraryDirectories");
            List<File> systemLibDirs = (List<File>) systemNativeLibraryDirectories.get(dexPathList);
            Method makePathElements =
                    ReflectUtil.findMethod(dexPathList, "makePathElements", List.class);
            libDirs.addAll(systemLibDirs);
            if (reverse) {
                libDirs.add(folder);
            }
            Object[] elements = (Object[]) makePathElements.
                    invoke(dexPathList, libDirs);
            Field nativeLibraryPathElements = ReflectUtil.findField(dexPathList, "nativeLibraryPathElements");
            nativeLibraryPathElements.setAccessible(true);
            nativeLibraryPathElements.set(dexPathList, elements);
        }
Replace the value of a field containing a non null array, by a new array containing the
elements of the original array plus the elements of extraElements.

@param instance      the instance whose field is to be modified.
@param fieldName     the field to modify.
@param extraElements elements to append at the end of the array.
freeline-runtime/src/main/java/com/antfortune/freeline/util/NativeUtils.java