Pkg.DEXDecompiler — API for decompiling Android DEX files¶
Overview¶
The Pkg.DEXDecompiler module contains the API for decompiling Android DEX files.
Decompiling a Class¶
The following code example demonstrates how to decompile a class in a DEX file:
from Pkg.DEXDecompiler import *
def main():
dec = DEXDecompiler()
dec.init("path/to/classes.dex")
# we specify the name of the class to decompile
text, _ = dec.decompile("com.android.providers.applications.ApplicationsAdapter")
if text != None:
print(text)
Module API¶
Pkg.DEXDecompiler module API.
Classes:
Android DEX decompiler class.
- class DEXDecompiler¶
Android DEX decompiler class.
Methods:
decompile(name_or_token[, language_version, …])Decompiles a class in the DEX file.
init(file_name)Initializes the class with the name of the DEX file.
Resets the cache of decompile code.
setIndentSize(size)Sets the indentation size for decompiled code.
- decompile(name_or_token: Union[str, int], language_version: Optional[str] = None, wait_object: Optional[Pro.Core.NTIWait] = None) → Tuple[Optional[str], Optional[Pro.Core.NTTextTags]]¶
Decompiles a class in the DEX file.
- Parameters
name_or_token (Union[str, int]) – The name or index of the class to decompile.
language_version (Optional[str]) – Reserved parameter.
wait_object (Optional[NTIWait]) – An optional wait object.
- Returns
Returns a tuple containing the decompiled text and text tags if successful; otherwise returns a tuple whose first value is
None.- Return type
Tuple[Optional[str], Optional[NTTextTags]]
See also
Pro.Core.NTTextTags.
- init(file_name: str) → None¶
Initializes the class with the name of the DEX file.
- Parameters
file_name (str) – The name of the DEX file to decompile.
See also
decompile().
- resetCache() → None¶
Resets the cache of decompile code.
- setIndentSize(size: int) → None¶
Sets the indentation size for decompiled code.
- Parameters
size (int) – The indent size.