Java Code Examples for dalvik.system.DexFile#loadDex()

The following examples show how to use dalvik.system.DexFile#loadDex() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DelegatingClassLoader.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * Clear the existing delegate and return the new one, populated with the given dex files
 *
 * @param dexJars the .dex.jar files which will be managed by our delegate
 */
void resetDelegate(List<File> dexJars) {
  mDelegate = new PathClassLoader("", "", this);
  mManagedClassesToDexFile.clear();
  for (File dexJar : dexJars) {
    try {
      final File optFile = new File(mDexOptDir, dexJar.getName());
      DexFile dexFile = DexFile.loadDex(dexJar.getCanonicalPath(), optFile.getCanonicalPath(), 0);
      final Enumeration<String> entries = dexFile.entries();
      while (entries.hasMoreElements()) {
        mManagedClassesToDexFile.put(entries.nextElement(), dexFile);
      }
    } catch (IOException e) {
      // Pass for now
    }
  }
}
 
Example 2
Source File: DexFileCompat.java    From atlas with Apache License 2.0 6 votes vote down vote up
static public DexFile loadDex(Context context, String sourcePathName, String outputPathName,
                              int flags) throws Exception {
    if(Build.VERSION.SDK_INT<=15) {
        return DexFile.loadDex(sourcePathName,outputPathName,flags);
    }else{
        DexFile dexFile = DexFile.loadDex(context.getApplicationInfo().sourceDir,null,0);
        try {
            int cookie = (int)openDexFile.invoke(null,sourcePathName,outputPathName,flags);
            mFileName.set(dexFile,sourcePathName);
            mCookie.set(dexFile,cookie);
        } catch (Exception e) {
            throw  e;
        }
        return dexFile;
    }
}
 
Example 3
Source File: MultiDex.java    From letv with Apache License 2.0 6 votes vote down vote up
private static void install(ClassLoader loader, List<File> additionalClassPathEntries) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, IOException {
    int extraSize = additionalClassPathEntries.size();
    Field pathField = MultiDex.findField(loader, "path");
    StringBuilder path = new StringBuilder((String) pathField.get(loader));
    String[] extraPaths = new String[extraSize];
    File[] extraFiles = new File[extraSize];
    ZipFile[] extraZips = new ZipFile[extraSize];
    DexFile[] extraDexs = new DexFile[extraSize];
    ListIterator<File> iterator = additionalClassPathEntries.listIterator();
    while (iterator.hasNext()) {
        File additionalEntry = (File) iterator.next();
        String entryPath = additionalEntry.getAbsolutePath();
        path.append(':').append(entryPath);
        int index = iterator.previousIndex();
        extraPaths[index] = entryPath;
        extraFiles[index] = additionalEntry;
        extraZips[index] = new ZipFile(additionalEntry);
        extraDexs[index] = DexFile.loadDex(entryPath, entryPath + ".dex", 0);
    }
    pathField.set(loader, path.toString());
    MultiDex.expandFieldArray(loader, "mPaths", extraPaths);
    MultiDex.expandFieldArray(loader, "mFiles", extraFiles);
    MultiDex.expandFieldArray(loader, "mZips", extraZips);
    MultiDex.expandFieldArray(loader, "mDexs", extraDexs);
}
 
Example 4
Source File: MultiDex.java    From atlas with Apache License 2.0 5 votes vote down vote up
private static void install(ClassLoader loader,
                            List<? extends File> additionalClassPathEntries)
        throws IllegalArgumentException, IllegalAccessException,
        NoSuchFieldException, IOException {
    /* The patched class loader is expected to be a descendant of
     * dalvik.system.DexClassLoader. We modify its
     * fields mPaths, mFiles, mZips and mDexs to append additional DEX
     * file entries.
     */
    int extraSize = additionalClassPathEntries.size();

    Field pathField = findField(loader, "path");

    StringBuilder path = new StringBuilder((String) pathField.get(loader));
    String[] extraPaths = new String[extraSize];
    File[] extraFiles = new File[extraSize];
    ZipFile[] extraZips = new ZipFile[extraSize];
    DexFile[] extraDexs = new DexFile[extraSize];
    for (ListIterator<? extends File> iterator = additionalClassPathEntries.listIterator();
         iterator.hasNext(); ) {
        File additionalEntry = iterator.next();
        String entryPath = additionalEntry.getAbsolutePath();
        path.append(':').append(entryPath);
        int index = iterator.previousIndex();
        extraPaths[index] = entryPath;
        extraFiles[index] = additionalEntry;
        extraZips[index] = new ZipFile(additionalEntry);
        extraDexs[index] = DexFile.loadDex(entryPath, entryPath + ".dex", 0);
    }

    pathField.set(loader, path.toString());
    expandFieldArray(loader, "mPaths", extraPaths);
    expandFieldArray(loader, "mFiles", extraFiles);
    expandFieldArray(loader, "mZips", extraZips);
    expandFieldArray(loader, "mDexs", extraDexs);
}
 
Example 5
Source File: MultiDex.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
private static void install(ClassLoader loader, List<File> additionalClassPathEntries)
                throws IllegalArgumentException, IllegalAccessException,
                NoSuchFieldException, IOException {
    /* The patched class loader is expected to be a descendant of
     * dalvik.system.DexClassLoader. We modify its
     * fields mPaths, mFiles, mZips and mDexs to append additional DEX
     * file entries.
     */
    int extraSize = additionalClassPathEntries.size();

    Field pathField = findField(loader, "path");

    StringBuilder path = new StringBuilder((String) pathField.get(loader));
    String[] extraPaths = new String[extraSize];
    File[] extraFiles = new File[extraSize];
    ZipFile[] extraZips = new ZipFile[extraSize];
    DexFile[] extraDexs = new DexFile[extraSize];
    for (ListIterator<File> iterator = additionalClassPathEntries.listIterator();
            iterator.hasNext();) {
        File additionalEntry = iterator.next();
        String entryPath = additionalEntry.getAbsolutePath();
        path.append(':').append(entryPath);
        int index = iterator.previousIndex();
        extraPaths[index] = entryPath;
        extraFiles[index] = additionalEntry;
        extraZips[index] = new ZipFile(additionalEntry);
        extraDexs[index] = DexFile.loadDex(entryPath, entryPath + ".dex", 0);
    }

    pathField.set(loader, path.toString());
    expandFieldArray(loader, "mPaths", extraPaths);
    expandFieldArray(loader, "mFiles", extraFiles);
    expandFieldArray(loader, "mZips", extraZips);
    expandFieldArray(loader, "mDexs", extraDexs);
}
 
Example 6
Source File: RocooFix.java    From RocooFix with MIT License 5 votes vote down vote up
private static void install(ClassLoader loader, List<File> additionalClassPathEntries)
        throws IllegalArgumentException, IllegalAccessException,
        NoSuchFieldException, IOException {
    /* The patched class loader is expected to be a descendant of
     * dalvik.system.DexClassLoader. We modify its
     * fields mPaths, mFiles, mZips and mDexs to append additional DEX
     * file entries.
     */
    int extraSize = additionalClassPathEntries.size();

    Field pathField = RocooUtils.findField(loader, "path");

    StringBuilder path = new StringBuilder((String) pathField.get(loader));
    String[] extraPaths = new String[extraSize];
    File[] extraFiles = new File[extraSize];
    ZipFile[] extraZips = new ZipFile[extraSize];
    DexFile[] extraDexs = new DexFile[extraSize];
    for (ListIterator<File> iterator = additionalClassPathEntries.listIterator();
         iterator.hasNext(); ) {
        File additionalEntry = iterator.next();
        String entryPath = additionalEntry.getAbsolutePath();
        path.append(':').append(entryPath);
        int index = iterator.previousIndex();
        extraPaths[index] = entryPath;
        extraFiles[index] = additionalEntry;
        extraZips[index] = new ZipFile(additionalEntry);
        extraDexs[index] = DexFile.loadDex(entryPath, entryPath + ".dex", 0);
    }

    pathField.set(loader, path.toString());
    RocooUtils.expandFieldArray(loader, "mPaths", extraPaths);
    RocooUtils.expandFieldArray(loader, "mFiles", extraFiles);
    RocooUtils.expandFieldArray(loader, "mZips", extraZips);
    RocooUtils.expandFieldArray(loader, "mDexs", extraDexs);
}
 
Example 7
Source File: ZeusPluginClassLoader.java    From ZeusPlugin with MIT License 5 votes vote down vote up
/***
 * 初始化
 */
protected synchronized void ensureInit() {
    if (mInitialized) {
        return;
    }

    String[] dexPathList;

    mInitialized = true;

    dexPathList = mRawDexPath.split(":");
    int length = dexPathList.length;

    mFiles = new File[length];
    mZips = new ZipFile[length];
    mDexs = new DexFile[length];

    for (int i = 0; i < length; i++) {
        File pathFile = new File(dexPathList[i]);
        mFiles[i] = pathFile;

        if (pathFile.isFile()) {
            try {
                mZips[i] = new ZipFile(pathFile);
            } catch (IOException ioex) {
                System.out.println("Failed opening '" + pathFile
                        + "': " + ioex);
            }
            try {
                String outputName =
                        generateOutputName(dexPathList[i], mDexOutputPath);
                mDexs[i] = DexFile.loadDex(dexPathList[i], outputName, 0);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    generateLibPath();
}
 
Example 8
Source File: MultiDex.java    From Neptune with Apache License 2.0 5 votes vote down vote up
static void install(ClassLoader loader,
                    List<? extends File> additionalClassPathEntries)
        throws IllegalArgumentException, IllegalAccessException,
        NoSuchFieldException, IOException {
    /* The patched class loader is expected to be a descendant of
     * dalvik.system.DexClassLoader. We modify its
     * fields mPaths, mFiles, mZips and mDexs to append additional DEX
     * file entries.
     */
    int extraSize = additionalClassPathEntries.size();

    Field pathField = findField(loader, "path");

    StringBuilder path = new StringBuilder((String) pathField.get(loader));
    String[] extraPaths = new String[extraSize];
    File[] extraFiles = new File[extraSize];
    ZipFile[] extraZips = new ZipFile[extraSize];
    DexFile[] extraDexs = new DexFile[extraSize];
    for (ListIterator<? extends File> iterator = additionalClassPathEntries.listIterator();
         iterator.hasNext(); ) {
        File additionalEntry = iterator.next();
        String entryPath = additionalEntry.getAbsolutePath();
        path.append(':').append(entryPath);
        int index = iterator.previousIndex();
        extraPaths[index] = entryPath;
        extraFiles[index] = additionalEntry;
        extraZips[index] = new ZipFile(additionalEntry);
        extraDexs[index] = DexFile.loadDex(entryPath, entryPath + ".dex", 0);
    }

    pathField.set(loader, path.toString());
    expandFieldArray(loader, "mPaths", extraPaths);
    expandFieldArray(loader, "mFiles", extraFiles);
    expandFieldArray(loader, "mZips", extraZips);
    expandFieldArray(loader, "mDexs", extraDexs);
}
 
Example 9
Source File: DexArchive.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void initDexFile() {
  String dexopt = new File(bundleDir, "dexopt" + revision + (subId > 0 ? "_" + subId : "")).getAbsolutePath();
  if (jar != null) {
    if (jar.getEntry(CLASSES_DEX) != null) {
      dexFile = DexFile.loadDex(file.getAbsolutePath(),  dexopt, 0);
    }
  } else {
    dexFile = DexFile.loadDex(new File(file, CLASSES_DEX).getAbsolutePath(), dexopt, 0);
  }
}
 
Example 10
Source File: DexLoader.java    From sbt-android-protify with Apache License 2.0 5 votes vote down vote up
private static void install(ClassLoader loader, List<File> additionalClassPathEntries)
        throws IllegalArgumentException, IllegalAccessException,
        NoSuchFieldException, IOException {
    /* The patched class loader is expected to be a descendant of
     * dalvik.system.DexClassLoader. We modify its
     * fields mPaths, mFiles, mZips and mDexs to append additional DEX
     * file entries.
     */
    int extraSize = additionalClassPathEntries.size();

    Field pathField = findField(loader, "path");

    StringBuilder path = new StringBuilder((String) pathField.get(loader));
    String[] extraPaths = new String[extraSize];
    File[] extraFiles = new File[extraSize];
    ZipFile[] extraZips = new ZipFile[extraSize];
    DexFile[] extraDexs = new DexFile[extraSize];
    for (ListIterator<File> iterator = additionalClassPathEntries.listIterator();
         iterator.hasNext();) {
        File additionalEntry = iterator.next();
        String entryPath = additionalEntry.getAbsolutePath();
        path.append(':').append(entryPath);
        int index = iterator.previousIndex();
        extraPaths[index] = entryPath;
        extraFiles[index] = additionalEntry;
        extraZips[index] = new ZipFile(additionalEntry);
        extraDexs[index] = DexFile.loadDex(entryPath, entryPath + ".dex", 0);
    }

    pathField.set(loader, path.toString());
    expandFieldArray(loader, "mPaths", extraPaths);
    expandFieldArray(loader, "mFiles", extraFiles);
    expandFieldArray(loader, "mZips", extraZips);
    expandFieldArray(loader, "mDexs", extraDexs);
}
 
Example 11
Source File: Smirk.java    From Smirk with MIT License 5 votes vote down vote up
private void putDex(File dexPath, Map<DexFile, ExtensionClassLoader> dexMap) {
    try {
        File outPath = mContext.getDir("smirk", 0);
        DexFile dexFile = DexFile.loadDex(dexPath.getAbsolutePath(), new File(outPath, dexPath.getName()).getAbsolutePath(), 0);
        ExtensionClassLoader classLoader = new ExtensionClassLoader(dexPath.getAbsolutePath(), outPath.getAbsolutePath(), null, mContext.getClassLoader());
        dexMap.put(dexFile, classLoader);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example 12
Source File: ZeusHotfixClassLoader.java    From ZeusPlugin with MIT License 4 votes vote down vote up
protected void addAPKPath(String dexPath, String libPath) {
    if(mDexs == null){
        ensureInit();
    }
    int oldLength = mDexs.length;
    int index = oldLength + 1;

    Object[] old = mDexs;
    mDexs = new DexFile[index];
    arraycopy(old, 0, mDexs, 0, index - 1);

    old = mFiles;
    mFiles = new File[index];
    arraycopy(old, 0, mFiles, 0, index - 1);

    old = mZips;
    mZips = new ZipFile[index];
    arraycopy(old, 0, mZips, 0, index - 1);

    if (!TextUtils.isEmpty(libPath)) {
        String pathSep = System.getProperty("path.separator", ":");
        if (mRawLibPath.endsWith(pathSep)) {
            mRawLibPath = mRawLibPath + libPath;
        } else {
            mRawLibPath = mRawLibPath + pathSep + libPath;
        }
        generateLibPath();

    }

    File pathFile = new File(dexPath);
    mFiles[oldLength] = pathFile;
    if (pathFile.isFile()) {
        try {
            mZips[oldLength] = new ZipFile(pathFile);
        } catch (IOException ioex) {
            System.out.println("Failed opening '" + pathFile
                    + "': " + ioex);
        }
    }

    try {
        String outputName =
                generateOutputName(dexPath, mDexOutputPath);
        mDexs[oldLength] = DexFile.loadDex(dexPath, outputName, 0);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example 13
Source File: FrameworkHack.java    From secondary-dex-gradle with Apache License 2.0 4 votes vote down vote up
public static void appendDexListImplUnderICS(String[] zipPathsToAppend, PathClassLoader pcl, File optDir)
    throws Exception {
    int oldSize = 1; // gonna assume the original path had single entry for simplicity
    Class pclClass = pcl.getClass();
    Field fPath = pclClass.getDeclaredField("path");
    fPath.setAccessible(true);
    String orgPath = fPath.get(pcl).toString();
    String pathToAdd = joinPaths(zipPathsToAppend);
    String path = orgPath + ':' + pathToAdd;
    forceSet(pcl, fPath, path);

    boolean wantDex = System.getProperty("android.vm.dexfile", "").equals("true");
    File[] files = new File[oldSize + zipPathsToAppend.length];
    ZipFile[] zips = new ZipFile[oldSize + zipPathsToAppend.length];
    DexFile[] dexs = new DexFile[oldSize + zipPathsToAppend.length];

    Field fmPaths = pclClass.getDeclaredField("mPaths");
    String[] newMPaths = new String[oldSize + zipPathsToAppend.length];
    // set originals
    newMPaths[0] = (String) forceGetFirst(pcl, fmPaths);
    forceSet(pcl, fmPaths, newMPaths);
    Field fmFiles = pclClass.getDeclaredField("mFiles");
    files[0] = (File) forceGetFirst(pcl, fmFiles);
    Field fmZips = pclClass.getDeclaredField("mZips");
    zips[0] = (ZipFile) forceGetFirst(pcl, fmZips);
    Field fmDexs = pclClass.getDeclaredField("mDexs");
    dexs[0] = (DexFile) forceGetFirst(pcl, fmDexs);

    for (int i = 0; i < zipPathsToAppend.length; i++) {
        newMPaths[oldSize + i] = zipPathsToAppend[i];
        File pathFile = new File(zipPathsToAppend[i]);
        files[oldSize + i] = pathFile;
        zips[oldSize + i] = new ZipFile(pathFile);
        if (wantDex) {
            String outDexName = pathFile.getName() + ".dex";
            File outFile = new File(optDir, outDexName);
            dexs[oldSize + i] = DexFile.loadDex(pathFile.getAbsolutePath(), outFile.getAbsolutePath(), 0);
        }
    }
    forceSet(pcl, fmFiles, files);
    forceSet(pcl, fmZips, zips);
    forceSet(pcl, fmDexs, dexs);
}
 
Example 14
Source File: BundleArchiveRevision.java    From AtlasForAndroid with MIT License 4 votes vote down vote up
private synchronized void loadDex(File file) throws IOException {
    if (this.dexFile == null) {
        this.dexFile = DexFile.loadDex(this.bundleFile.getAbsolutePath(), file.getAbsolutePath(), 0);
    }
}
 
Example 15
Source File: ClassesListActivity.java    From android-classyshark with Apache License 2.0 4 votes vote down vote up
@Override
public void run() {

    try {
        Thread.currentThread().setPriority(Thread.MAX_PRIORITY);

        File incomeFile = File.createTempFile("classes" + Thread.currentThread().getId(), ".dex", getCacheDir());

        IOUtils.bytesToFile(bytes, incomeFile);

        File optimizedFile = File.createTempFile("opt" + Thread.currentThread().getId(), ".dex", getCacheDir());

        DexFile dx = DexFile.loadDex(incomeFile.getPath(),
                optimizedFile.getPath(), 0);

        for (Enumeration<String> classNames = dx.entries(); classNames.hasMoreElements(); ) {
            String className = classNames.nextElement();
            classesList.add(className);
        }

    } catch (Exception e) {
        // ODEX, need to see how to handle
        e.printStackTrace();
    }


    ClassesListActivity.this.runOnUiThread(new Runnable() {
        @Override
        public void run() {

            final ArrayList<String> list = new ArrayList<>();
            for (int i = 0; i < classesList.getClassNames().size(); ++i) {
                list.add(classesList.getClassNames().get(i));
            }
            final StableArrayAdapter adapter = new StableArrayAdapter(ClassesListActivity.this,
                    android.R.layout.simple_list_item_1, list);
            lv.setAdapter(adapter);

            mProgressDialog.dismiss();

            if(classesList.getClassNames().isEmpty()) {
                Toast.makeText(ClassesListActivity.this, "Sorry don't support ODEX", Toast.LENGTH_LONG).show();
            }
        }
    });
}
 
Example 16
Source File: BundleArchiveRevision.java    From ACDD with MIT License 4 votes vote down vote up
private synchronized void loadDex(File file) throws IOException {
    if (this.dexFile == null) {
        this.dexFile = DexFile.loadDex(this.bundleFile.getAbsolutePath(),
                file.getAbsolutePath(), 0);
    }
}
 
Example 17
Source File: FrameworkHack.java    From pokemon-go-xposed-mitm with GNU General Public License v3.0 4 votes vote down vote up
public static void appendDexListImplUnderICS(String[] jarPathsToAppend, PathClassLoader pcl, File optDir)
        throws Exception {
    int oldSize = 1; // gonna assume the original path had single entry for simplicity
    Class pclClass = pcl.getClass();
    Field fPath = pclClass.getDeclaredField("path");
    fPath.setAccessible(true);
    String orgPath = fPath.get(pcl).toString();
    String pathToAdd = joinPaths(jarPathsToAppend);
    String path = orgPath + ':' + pathToAdd;
    forceSet(pcl, fPath, path);

    boolean wantDex = System.getProperty("android.vm.dexfile", "").equals("true");
    File[] files = new File[oldSize + jarPathsToAppend.length];
    ZipFile[] zips = new ZipFile[oldSize + jarPathsToAppend.length];
    DexFile[] dexs = new DexFile[oldSize + jarPathsToAppend.length];

    Field fmPaths = pclClass.getDeclaredField("mPaths");
    String[] newMPaths = new String[oldSize + jarPathsToAppend.length];
    // set originals
    newMPaths[0] = (String) forceGetFirst(pcl, fmPaths);
    forceSet(pcl, fmPaths, newMPaths);
    Field fmFiles = pclClass.getDeclaredField("mFiles");
    files[0] = (File) forceGetFirst(pcl, fmFiles);
    Field fmZips = pclClass.getDeclaredField("mZips");
    zips[0] = (ZipFile) forceGetFirst(pcl, fmZips);
    Field fmDexs = pclClass.getDeclaredField("mDexs");
    dexs[0] = (DexFile) forceGetFirst(pcl, fmDexs);

    for (int i = 0; i < jarPathsToAppend.length; i++) {
        newMPaths[oldSize + i] = jarPathsToAppend[i];
        File pathFile = new File(jarPathsToAppend[i]);
        files[oldSize + i] = pathFile;
        zips[oldSize + i] = new ZipFile(pathFile);
        if (wantDex) {
            String outDexName = pathFile.getName() + ".dex";
            File outFile = new File(optDir, outDexName);
            dexs[oldSize + i] = DexFile.loadDex(pathFile.getAbsolutePath(), outFile.getAbsolutePath(), 0);
        }
    }
    forceSet(pcl, fmFiles, files);
    forceSet(pcl, fmZips, zips);
    forceSet(pcl, fmDexs, dexs);
}
 
Example 18
Source File: KernalBundle.java    From atlas with Apache License 2.0 4 votes vote down vote up
public static boolean checkLoadKernalDebugPatch(Application application) {
    if (Build.VERSION.SDK_INT < 21) {
        //暂时只支持art设备的debug调试
        return false;
    }

    boolean loadKernalPatch = false;
    try {
        ApplicationInfo app_info = application.getApplicationInfo();
        boolean debug = (app_info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
        if (debug) {
            File debugBundleDir = new File(KernalConstants.baseContext.getExternalFilesDir("debug_storage"), KERNAL_BUNDLE_NAME);
            File patchFile = new File(debugBundleDir, "patch.zip");
            if (patchFile.exists()) {
                loadKernalPatch = true;
                KernalBundle bundle = new KernalBundle();
                //DexFile dexFile = (DexFile) KernalConstants.dexBooster.loadDex(KernalConstants.baseContext, KernalConstants.baseContext.getApplicationInfo().sourceDir,
                //        new File(patchFile.getParent(), "base.dex").getAbsolutePath(), 0, true);

                File internalDebugBundleDir = new File(new File(application.getFilesDir(), "debug_storage"), KERNAL_BUNDLE_NAME);
                internalDebugBundleDir.mkdirs();
                DexFile patchDexFile = (DexFile) DexFile.loadDex(patchFile.getAbsolutePath(),new File(internalDebugBundleDir, "patch.dex").getAbsolutePath(), 0);
                if (bundle.needReplaceClassLoader(application)) {
                    NClassLoader loader = new NClassLoader(".", KernalBundle.class.getClassLoader().getParent());
                    try {
                        NClassLoader.replacePathClassLoader(KernalConstants.baseContext, KernalBundle.class.getClassLoader(), loader);
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                }
                bundle.installKernalBundle(KernalConstants.baseContext.getClassLoader(), patchFile, new DexFile[]{patchDexFile/*, dexFile*/}, null,
                    true /*(app_info.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0*/);
                bundle.prepareRuntimeVariables(application);
                Class DelegateResourcesClazz = application.getClassLoader().loadClass("android.taobao.atlas.runtime.DelegateResources");
                DelegateResourcesClazz.getDeclaredMethod("addApkpatchResources", String.class)
                        .invoke(DelegateResourcesClazz, patchFile.getAbsolutePath());
                Toast.makeText(KernalConstants.baseContext, "当前处于DEBUG调试状态,不支持动态更新,清除数据可恢复", Toast.LENGTH_LONG).show();
            }
        }
    } finally {
        return loadKernalPatch;
    }
}