Registry / devops / androguard

androguard

JSON →
library4.1.4pypypi✓ verified 23d ago

Androguard is a comprehensive Python toolkit for reverse engineering and analyzing Android applications. It supports various Android file formats like DEX, ODEX, APK, Android's binary XML, and resources. The library offers capabilities for disassembly, basic decompilation, static and dynamic analysis, and Frida integration. The project is actively maintained, with version 4.1.3 released on February 24, 2025, representing a significant evolution from the 3.x series.

pip install androguard
INSTALL
IMPORT
SIG · ANDROGUARD
A
androguard
devopspythonv4.1.4
Install
10.5s avg
Import
1979ms
Disk
163MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.1.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 2.100s · 167.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 10.5s · import 1.858s · 166MB
163MB installed
● package 163MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AnalyzeAPK
from androguard.misc import AnalyzeAPK
APK
from androguard.core.apk import APK
DEX
from androguard.core.dex import DEX
Analysis
from androguard.core.analysis.analysis import Analysis

This quickstart demonstrates how to load and perform basic static analysis on an APK file using `AnalyzeAPK`. It retrieves the package name, main activity, permissions, and counts of DEX files and classes. Replace 'path/to/your/app.apk' or set the `ANDROGUARD_SAMPLE_APK` environment variable to a valid APK path for execution.

from androguard.misc import AnalyzeAPK import os # NOTE: Replace 'path/to/your/app.apk' with an actual APK file path. # For a runnable example, you'd need a sample APK. apk_file_path = os.environ.get('ANDROGUARD_SAMPLE_APK', 'path/to/your/app.apk') try: # Analyze the APK file a, d, dx = AnalyzeAPK(apk_file_path) print(f"Package Name: {a.get_package()}") print(f"Main Activity: {a.get_main_activity()}") print("Permissions:") for perm in a.get_permissions(): print(f" - {perm}") print(f"Number of DEX files: {len(d)}") print(f"Total classes analyzed: {len(dx.get_classes())}") except Exception as e: print(f"Error analyzing APK: {e}") print("Please ensure 'ANDROGUARD_SAMPLE_APK' environment variable points to a valid APK, or replace 'path/to/your/app.apk' with a real path.")
androguard --version
Debug
Known issues
breakingAndroguard versions 4.0.0 and later introduce substantial differences and removed functionalities compared to the previous stable version 3.3.5 (released in 2019). Code written for 3.x might not be compatible with 4.x.
fix
Review the official GitHub documentation and issue tracker for migration guides. Expect refactoring of existing scripts.
affects: >=4.0.0
breakingSupport for Python 2.7 was officially dropped in Androguard 4.0.1. The library now requires Python 3.9 or higher.
fix
Upgrade your Python environment to 3.9 or newer. Ensure your project's `requirements.txt` specifies compatible Python versions.
affects: >=4.0.1
deprecatedBetween versions 3.2 and 3.3.3/3.3.5, the AXML parser and related functions underwent significant refactoring and reorganization. Some functions were renamed or removed, especially those dealing with namespace resolution.
fix
Projects built on older 3.x versions using AXML parsing should carefully check for renamed/removed functions and adjust their code accordingly. Consult `androguard.core.bytecodes.axml` module changes.
affects: 3.x
gotchaUsing `Session` objects for bulk analysis of many APKs can lead to very large storage consumption, as session objects can be more than 30 times larger than the original APK.
fix
For bulk analysis, consider pickling the `APK` and `Analysis` objects directly, or utilize the `AndroAuto` framework which is designed for large-scale analysis. Be mindful of disk space.
affects: All
gotchaAndroguard's parsing of `AndroidManifest.xml` can sometimes fail when encountering 'edge cases' or deliberately malformed APKs (e.g., in malware).
fix
Before reporting an issue, try using official Android tools like `aapt2` or `apkanalyzer` to decode the manifest. Check ZIP file integrity. If the file is indeed malformed and causes issues, report it to the Androguard project.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'androguard.core.bytecodes'
The 'androguard.core.bytecodes' module has been relocated in newer versions of Androguard.
fix
Update the import statement to 'from androguard.core import axml'.
NameError: name 'AnalyzeAPK' is not defined
The 'AnalyzeAPK' function is not imported or defined in the current scope.
fix
Import the function using 'from androguard.misc import AnalyzeAPK'.
MemoryError
Analyzing large APK files can exceed available memory resources.
fix
Ensure sufficient system memory is available or analyze smaller APK files.
TypeError: 'NoneType' object is not iterable
This error typically occurs when Androguard attempts to iterate over an object that is `None`, often due to an underlying parsing error or an unexpected structure within the analyzed APK, such as a DEX file lacking string data or other malformed components.
fix
Ensure the `androguard` library and its dependencies (like `apkInspector`) are updated to their latest versions, as these issues are often resolved in newer releases. If the problem persists with a specific APK, the APK itself might be malformed. [14]
AttributeError: 'NoneType' object has no attribute 'filename'
This error originates from `apkInspector` (a dependency of Androguard) when it encounters an APK with a malformed ZIP structure, specifically when entries in the central directory are not properly available in the local file entries.
fix
Update the `apkInspector` library to its latest version (e.g., `pip install --upgrade apkInspector`). This issue has been patched in `apkInspector` version 1.3.3 and later. [23]
Upgrade
Version history
4.1.4latest on PyPI · released Jun 1, 2026
Audit
Dependencies
pythonrequiredAndroguard requires Python 3.9 or higher, but not Python 4.x.
Agent activity
94 hits · last 30 days
node
84
OpenAI (training)
1
Resources
androguard — pip install androguard · libregistry