try { SmaliOptions options = new SmaliOptions(); options.setOutputDexFile(false); String inputFilePath = "path/to/dalvikBytecode.dex"; VirtualFile inputFile = new VirtualFile(new File(inputFilePath)); DexBackedDexFile dexFile = DexFileFactory.loadDexFile(inputFile, options); for (DexBackedClassDef classDef : dexFile.getClasses()) { String className = classDef.getType(); } } catch (Exception e) { e.printStackTrace(); } try { SmaliOptions options = new SmaliOptions(); options.setOutputDexFile(true); String inputFilePath = "path/to/dalvikBytecode.dex"; VirtualFile inputFile = new VirtualFile(new File(inputFilePath)); DexBackedDexFile dexFile = DexFileFactory.loadDexFile(inputFile, options); String outputFilePath = "path/to/modifiedBytecode.dex"; File outputFile = new File(outputFilePath); DexFileWriter.writeToFile(outputFile, options, dexFile); } catch (Exception e) { e.printStackTrace(); }


上一篇:
下一篇:
切换中文