feat: add multi-DEX support for parsing APKs and directories#1
Open
komen205 wants to merge 1 commit intoandroguard:mainfrom
Open
feat: add multi-DEX support for parsing APKs and directories#1komen205 wants to merge 1 commit intoandroguard:mainfrom
komen205 wants to merge 1 commit intoandroguard:mainfrom
Conversation
Android apps exceeding the 65K method limit split across multiple DEX files (classes.dex, classes2.dex, ...). This adds MultiDexHelper (Rust) and MultiDEXHelper (Python) that provide a unified view across all DEX files with source provenance tracking. - New MultiDexHelper/MultiDEXHelper with from_apk(), from_directory() - Sourced<T> wrapper tags each item with its source DEX filename - APK support via optional `zip` crate behind `apk` feature flag - CLI: --apk and --dir flags for multi-DEX mode - 7 unit tests + 1 integration test against real 10-DEX APK - Python uses stdlib zipfile (zero new dependencies) - Fully backward compatible: existing single-DEX API unchanged Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Android apps exceeding the 65K method reference limit use multiple DEX files (
classes.dex,classes2.dex, ...,classesN.dex). This PR implements the Multi-DEX Aware feature from the README TODO, providing a unified view across all DEX files in an APK or directory.MultiDexHelperwithfrom_directory()andfrom_apk()constructors, unifiedclasses()/methods()/fields()/strings()iterators,Sourced<T>wrapper for provenance trackingMultiDEXHelperwithfrom_apk(),from_directory(),from_dex_files()constructors, unified iterators yielding(DexSource, item)tuples--apkand--dirflags for both Rust and Python CLIsDesign
Since
DexHelper/DEXHelperalready resolve all indices to strings, there's no need to merge index namespaces.MultiDexHelperwraps multipleDexHelperinstances and flat-maps their iterators, tagging each item with its source DEX filename. Fully backward compatible — no changes to existing APIs.Dependencies
zipcrate behindapkfeature flag (cargo build --features apk)zipfile— zero new dependenciesTested against
Ticketmaster APK (10 DEX files, 82K+ classes, 50K+ methods):
Files changed
dexparser-rs/src/multidex.rsMultiDexHelper,DexSource,Sourced<T>, constructors, iterators, 7 unit tests + 1 integration testdexparser/multidex.pyMultiDEXHelper,DexSource, constructors, iteratorsdexparser-rs/src/error.rsNoDexFiles,Ioerror variantsdexparser-rs/src/lib.rspub mod multidex+ re-exportsdexparser-rs/Cargo.tomlzipdep +apkfeaturedexparser-rs/src/bin/dexparser.rs--apk/--dirCLI flagsdexparser/__init__.pyMultiDEXHelper,DexSourcedexparser/main.py--apk/--dirCLI flagsREADME.md[TODO], add multi-DEX usage examplesTest plan
cargo test— 28 unit tests pass (sort key, name matching, empty/single/multi DEX, directory scan)cargo test --features apk test_real_apk -- --ignored— integration test against real 10-DEX APKcargo run --bin dexparser -- -i classes.dex— single-DEX backward compat verifiedcargo run --features apk --bin dexparser -- --apk base.apk— multi-DEX APK parsing verified--apkand--dirflags functional🤖 Generated with Claude Code