Added new DexFileModule constructor to support specific dex files inside apks.

This commit is contained in:
Sifis Lagouvardos 2018-09-13 14:21:41 +03:00 committed by Manu Sridharan
parent 1867b57425
commit 2ab002df3e
1 changed files with 24 additions and 0 deletions

View File

@ -120,6 +120,30 @@ public class DexFileModule implements Module {
}
}
/**
* @param f
* the .dex or .apk file
* @param entry
* the name of the .dex file inside the apk
* @param apiLevel
* the api level wanted
* @throws IllegalArgumentException
*/
public DexFileModule(File f, String entry, int apiLevel) throws IllegalArgumentException {
try {
this.f = f;
dexfile = DexFileFactory.loadDexEntry(f, entry,true, Opcodes.forApi(apiLevel));
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
// create ModuleEntries from ClassDefItem
entries = new HashSet<>();
for (ClassDef cdefitems : dexfile.getClasses()) {
entries.add(new DexModuleEntry(cdefitems, this));
}
}
/**
* @return The DexFile associated to this module.
*/