Apktool

class apkinjector.apktool.Apktool

A wrapper class for the different Apktool commands.

static advanced()

Obtain advanced information of the Apktool.

Returns

The stdout from the command execution.

Return type

str

static build(app_path, force_all=False, output=None, framework_path=None, use_aapt2=False)

Build the unpacked apk from the given path with the provided options.

Parameters
  • app_path (str) – The path of the app to build.

  • force_all (bool, optional) – Whether to skip changes detection and build all files, defaults to False.

  • output (str, optional) – The name of the output APK file, defaults to None.

  • framework_path (str, optional) – The directory containing framework files, defaults to None.

  • use_aapt2 (bool, optional.) – Whether to use aapt 2 or no, defaults to False.

Returns

The stdout from the command execution.

Return type

str

static decode(file_apk, force=False, output=None, framework_path=None, no_res=False, no_src=False, tag=None, force_manifest=False)

Decode an APK file with provided options.

Parameters
  • file_apk (str) – The APK file to be decoded.

  • force (bool, optional) – Whether to force delete the destination directory, defaults to False.

  • output (str, optional) – The name of the output folder, defaults to None.

  • framework_path (str, optional) – The directory containing framework files, defaults to None.

  • no_res (bool, optional) – Whether to not decode resources, defaults to False.

  • no_src (bool, optional) – Whether to not decode sources, defaults to False.

  • tag (str, optional) – A tag for the framework file, defaults to None.

  • force_manifest (str, optional) – Forces decode of AndroidManifest.xml regardless of decoding of resources parameter.

Returns

The stdout from the command execution.

Return type

str

static install(path: str = None, progress_callback: Callable = None) → None

Install apktool.

Parameters
  • path (str, optional) – Path to existing apktool.jar. If not found, will use the system installed one or download it. Defaults to None.

  • progress_callback (callable, optional) – Callback to be called when install progress changes, defaults to None.

static install_framework(framework_apk, framework_path=None, tag=None)

Install framework with provided options.

Parameters
  • framework_apk (str) – The APK framework file to be installed.

  • framework_path (str, optional) – The directory where to store framework files, defaults to None.

  • tag (str, optional) – The tag for the framework file, defaults to None.

Returns

The stdout from the command execution.

Return type

str

static version()

Obtain the version of the Apktool.

Returns

The stdout from the command execution.

Return type

str