Class DexInputCommand

java.lang.Object
org.jf.util.jcommander.Command
org.jf.baksmali.DexInputCommand
Direct Known Subclasses:
DisassembleCommand, DumpCommand, ListClassesCommand, ListFieldOffsetsCommand, ListReferencesCommand, ListVtablesCommand

public abstract class DexInputCommand extends Command
This class implements common functionality for commands that need to load a dex file based on command line input
  • Field Details

  • Constructor Details

    • DexInputCommand

      public DexInputCommand(@Nonnull List<com.beust.jcommander.JCommander> commandAncestors)
  • Method Details

    • loadDexFile

      protected void loadDexFile(@Nonnull String input)
      Parses a dex file input from the user and loads the given dex file. In some cases, the input file can contain multiple dex files. If this is the case, you can refer to a specific dex file with a slash, followed by the entry name, optionally in quotes. If the entry name is enclosed in quotes, then it will strip the first and last quote and look for an entry with exactly that name. Otherwise, it will perform a partial filename match against the entry to find any candidates. If there is a single matching candidate, it will be used. Otherwise, an error will be generated. For example, to refer to the "/system/framework/framework.jar:classes2.dex" entry within the "framework/arm/framework.oat" oat file, you could use any of: framework/arm/framework.oat/"/system/framework/framework.jar:classes2.dex" framework/arm/framework.oat/system/framework/framework.jar:classes2.dex framework/arm/framework.oat/framework/framework.jar:classes2.dex framework/arm/framework.oat/framework.jar:classes2.dex framework/arm/framework.oat/classes2.dex The last option is the easiest, but only works if the oat file doesn't contain another entry with the "classes2.dex" name. e.g. "/system/framework/blah.jar:classes2.dex" It's technically possible (although unlikely) for an oat file to contain 2 entries like: /system/framework/framework.jar:classes2.dex system/framework/framework.jar:classes2.dex In this case, the "framework/arm/framework.oat/system/framework/framework.jar:classes2.dex" syntax will generate an error because both entries match the partial entry name. Instead, you could use the following for the first and second entry respectively: framework/arm/framework.oat/"/system/framework/framework.jar:classes2.dex" framework/arm/framework.oat/"system/framework/framework.jar:classes2.dex"
      Parameters:
      input - The name of a dex, apk, odex or oat file/entry.