Java Code Examples for org.jf.dexlib2.dexbacked.DexBackedDexFile#getClasses()
The following examples show how to use
org.jf.dexlib2.dexbacked.DexBackedDexFile#getClasses() .
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: SmaliDiffUtils.java From atlas with Apache License 2.0 | 6 votes |
public static Set<DexBackedClassDef> scanClasses(File smaliDir, List<File> newFiles) throws PatchException { Set<DexBackedClassDef> classes = Sets.newHashSet(); try { for (File newFile : newFiles) { DexBackedDexFile newDexFile = DexFileFactory.loadDexFile(newFile, Opcodes.getDefault()); Set<? extends DexBackedClassDef> dexClasses = newDexFile.getClasses(); classes.addAll(dexClasses); } final ClassFileNameHandler outFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali"); final ClassFileNameHandler inFileNameHandler = new ClassFileNameHandler(smaliDir, ".smali"); for (DexBackedClassDef classDef : classes) { String className = classDef.getType(); ApkPatch.currentClassType = null; AfBakSmali.disassembleClass(classDef, outFileNameHandler, getBuildOption(classes, 19), true, true); File smaliFile = inFileNameHandler.getUniqueFilenameForClass(className); } } catch (Exception e) { throw new PatchException(e); } return classes; }
Example 2
Source File: D8DexMergerTest.java From bundletool with Apache License 2.0 | 5 votes |
private static ImmutableSet<String> listClassesInDexFiles(Collection<Path> dexPaths) throws Exception { ImmutableSet.Builder<String> classes = ImmutableSet.builder(); for (Path dexPath : dexPaths) { DexBackedDexFile dexFile = DexFileFactory.loadDexFile(dexPath.toFile(), Opcodes.getDefault()); for (DexBackedClassDef clazz : dexFile.getClasses()) { classes.add(clazz.getType()); } } return classes.build(); }
Example 3
Source File: DexFile.java From apkfile with Apache License 2.0 | 5 votes |
private synchronized void cacheLocalClasses(DexBackedDexFile dexFile) { /* * Must collect all local classes before any analysis because an API method is defined as * any non-local method. In multi-dex situations, there many be many API calls which are not * local to a single DEX. */ for (DexBackedClassDef classDef : dexFile.getClasses()) { String classPath = classDef.getType(); LOCAL_CLASS_PATHS.add(classPath); } }
Example 4
Source File: DexClassProvider.java From JAADAS with GNU General Public License v3.0 | 5 votes |
/** * Return names of classes in dex/apk file. * * @param file * file to dex/apk file. Can be the path of a zip file. * * @return set of class names */ public static Set<String> classesOfDex(File file) throws IOException { Set<String> classes = new HashSet<String>(); // TODO (SA): Go for API 1 because DexlibWrapper does so, but needs more attention DexBackedDexFile d = DexFileFactory.loadDexFile(file, 1, false); for (ClassDef c : d.getClasses()) { String name = Util.dottedClassName(c.getType()); classes.add(name); } return classes; }