3

I use DexClassloader to load a dex file from /data/data/packagename/ just like:

private static synchronized Boolean injectAboveEqualApiLevel14(
            String dexPath, String defaultDexOptPath, String nativeLibPath, String dummyClassName) {
        BaseDexClassLoader pathClassLoader = (BaseDexClassLoader) DexInjector.class.getClassLoader();
        DexClassLoader dexClassLoader = new DexClassLoader(dexPath, defaultDexOptPath, nativeLibPath, pathClassLoader);
        try {
            dexClassLoader.loadClass(dummyClassName);
            Object dexElements = combineArray(
                    getDexElements(getPathList(pathClassLoader)),
                    getDexElements(getPathList(dexClassLoader)));
            Object pathList = getPathList(pathClassLoader);
            setField(pathList, pathList.getClass(), "dexElements", dexElements);
        } catch (Throwable e) {
            LogTool.i(TAG, "Throwable: " + e.toString() + "\n" + e.getMessage() + "\n");
            e.printStackTrace();
            return false;
        }
        return true;
    }

It run perfectly on most of machine and system....... But today, a user feedback that dex file can't be loaded,,,Here is the importance Error Log:

12-03 15:19:12.725: E/dalvikvm(32068): waitpid failed: wanted 32099, got -1: No child processes
12-03 15:19:12.725: E/dalvikvm(32068): Unable to extract+optimize DEX from '/data/data/com.test.plugin/dex/classes1.dex', err: No child processes

Phone Information: HTC 9060, Android 4.2.2,HTC Sense 5.0

It's a strange bug. Here is the complete log:

  12-03 15:19:12.725: E/dalvikvm(32068): waitpid failed: wanted 32099, got -1: No child processes
12-03 15:19:12.725: E/dalvikvm(32068): Unable to extract+optimize DEX from '/data/data/com.test.plugin/dex/classes1.dex', err: No child processes
12-03 15:19:12.725: E/System(32068): Unable to load dex file: /data/data/com.test.plugin/dex/classes1.dex
12-03 15:19:12.725: E/System(32068): java.io.IOException: unable to open DEX file
12-03 15:19:12.725: E/System(32068):    at dalvik.system.DexFile.openDexFile(Native Method)
12-03 15:19:12.725: E/System(32068):    at dalvik.system.DexFile.<init>(DexFile.java:109)
12-03 15:19:12.725: E/System(32068):    at dalvik.system.DexFile.loadDex(DexFile.java:149)
12-03 15:19:12.725: E/System(32068):    at dalvik.system.DexPathList.loadDexFile(DexPathList.java:251)
12-03 15:19:12.725: E/System(32068):    at dalvik.system.DexPathList.makeDexElements(DexPathList.java:210)
12-03 15:19:12.725: E/System(32068):    at dalvik.system.DexPathList.<init>(DexPathList.java:96)
12-03 15:19:12.725: E/System(32068):    at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:56)
12-03 15:19:12.725: E/System(32068):    at dalvik.system.DexClassLoader.<init>(DexClassLoader.java:57)
12-03 15:19:12.725: E/System(32068):    at com.test.plugin.main.a.a.d(ProGuard:153)
12-03 15:19:12.725: E/System(32068):    at com.test.plugin.main.a.a.a(ProGuard:46)
12-03 15:19:12.725: E/System(32068):    at com.test.plugin.main.b.a(ProGuard:41)
12-03 15:19:12.725: E/System(32068):    at com.test.plugin.main.c.a(ProGuard:104)
12-03 15:19:12.725: E/System(32068):    at com.test.plugin.main.c.a(ProGuard:79)
12-03 15:19:12.725: E/System(32068):    at com.test.plugin.main.c.a(ProGuard:69)
12-03 15:19:12.725: E/System(32068):    at com.test.plugin.main.e.run(ProGuard:74)
RoseJames
  • 31
  • 3
  • did the user have the file stored on an SD card that they removed or reformatted? Looks like the file was missing... – Jim Dec 03 '15 at 08:25
  • I had confirm the file is in the right path. I think it failed in dexopt process.But do not know why. – RoseJames Dec 03 '15 at 08:34

0 Answers0