Bundle

class apkinjector.bundle.Bundle

Tools to work with apk bundles (xapk and apks)

static extract(source: str, output_path: str) → apkinjector.bundle.BundleInfo

Extract a bundle (xapk and apks) to a given path.

Parameters
  • source (str) – Path to the bundle.

  • output_path (str) – Destination of the bundled.

Returns

BundleInfo class containing the name of the base apk and configuration ifno.

Return type

BundleInfo

static is_bundle(source: str) → bool

Checks if the source is a bundle or not.

Parameters

source (str) – Source to check.

Returns

True if it’s a bundle, False otherwise.

Return type

bool

static repack(source: str, output_path: str) → str

Repacks a bundle (xapk and apks) to a given path.

Parameters
  • source (str) – Path to the extracted bundle.

  • output_path (str) – Path to where to save the bundle file.

Returns

Location of the repacked bundle.

class apkinjector.bundle.BundleInfo(base_apk: str, configs: List[Union[apkinjector.bundle.ConfigDpi, apkinjector.bundle.ConfigLocale, apkinjector.bundle.ConfigArch]])

A data class representing general information about an Android Bundle file.

Parameters
  • base_apk (str) – The name of the base APK file extracted from the Android Bundle.

  • ConfigLocale, ConfigArch]] configs (List[Union[ConfigDpi,) – Configurations of the APK files extracted from the Android Bundle.

class apkinjector.bundle.ConfigArch(file_name: str, arch: str)

A Data class representing the architecture information in a split APK file.

Parameters
  • file_name (str) – The name of the APK file.

  • arch (str) – The architecture type of the APK file (‘ARM’, ‘ARM64’, ‘X86’, ‘X64’).

class apkinjector.bundle.ConfigDpi(file_name: str, dpi: str)

A Data class representing the DPI information in a split APK file.

Parameters
  • file_name (str) – The name of the APK file.

  • dpi (str) – A string representing the screen DPI config of the APK.

class apkinjector.bundle.ConfigLocale(file_name: str, locale: str)

A Data class representing the locale information in a split APK file.

Parameters
  • file_name (str) – A string representing the name of the APK file.

  • locale (str) – A string indicating the locale config of the APK file.