Python wrapper for aapt • ApkFile, XapkFile, ApkmFile
Project description
⛏️ apkfile • Python wrapper for aapt
apkfile is a Python wrapper for the Android Asset Packaging Tool (aapt) that allows you to extract information from Android APK files.
Why did I create apkfile? There are several libraries for getting information from APK files, but most of them lack information such as abis
, min_sdk
, split_name
and more. And besides, they are relatively complicated, there is nothing to get complicated here. Provide an apk file and receive the information.. simple and easy. See Available attributes.
Usage
from apkfile import ApkFile, XapkFile, ApkmFile
# Get apk info
apk_file = ApkFile(path='/home/david/Downloads/wa.apk')
print(apk_file.package_name, apk_file.version_name, apk_file.version_code)
print(apk_file.as_dict())
# Get apkm info
apkm_file = ApkmFile('/home/david/Downloads/chrome.apkm')
for split in apkm_file.splits:
print(split.split_name)
apkm_file.install(check=True, upgrade=True)
# Using context manager (delete the extracted files when done)
with XapkFile(path='/home/david/Downloads/telegram.xapk') as xf:
print(xf.base.abis, x.permissions, x.langs)
Installation
Install with pip
pip3 install -U apkfile
Or, install from source:
git clone https://github.com/david-lev/apkfile.git
cd apkfile
python3 setup.py install
Install aapt
apkfile requires aapt
to be in the PATH
.
In each operating system, the way to install aapt is different, if you installed Android Studio, add one of the build-tools paths to the PATH
, if you are on a Debian-based Linux system (Ubuntu etc.) you can install with sudo apt install aapt
, and on Windows and Mac? Just google "How to install aapt on X".
- If you do not have access to
PATH
, you can manually provide a path to aapt by calling theApkFile(..., aapt_path='/path/to/aapt/')
.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.