Group DEX treemap by known libraries#641
Draft
trevor-e wants to merge 1 commit into
Draft
Conversation
Recognized third-party libraries (AndroidX, Kotlin, Firebase, Sentry, etc.) are pulled out of the DEX package hierarchy and grouped under a single "Libraries" node, keyed by canonical library name with the matched package prefix stripped. First-party code keeps its normal package tree. Sizes are preserved since each class is placed exactly once. Adds a conservative, easy-to-extend catalog of Android libraries keyed by distinctive package prefixes. This is the Android analog of EME-139 (group iOS by known libraries). Generated with [Linear](https://linear.app/getsentry/issue/EME-108/group-dex-by-known-libraries#agent-session-d849543d) Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
Contributor
📲 Install BuildsiOS
Android
|
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.
The Android DEX treemap groups classes purely by package hierarchy, so third-party SDKs are indistinguishable from the app's own code. This is the Android analog of #632 (group iOS by known libraries).
This adds a curated catalog of well-known Android libraries (
android_known_libraries.py) keyed by distinctive package prefixes (AndroidX, Kotlin, Firebase, Sentry, OkHttp, etc.). InDexElementBuilder, recognized classes are pulled out and grouped under a singleLibrariesnode — keyed by canonical library name, with the matched prefix stripped from the nested hierarchy — while first-party code keeps its normal package tree. Sizes are preserved (each class is placed exactly once), so no newTreemapType/frontend changes are needed.The catalog is intentionally conservative and easy to extend. Prefixes are matched on package boundaries and the most specific prefix wins, so e.g.
com.emergetools.snapshotsgroups as a library but a first-partycom.emergetools.hackernewsapp does not.Example (from the Hacker News test fixture):
Testing
resolve_known_libraryand for the grouping/prefix-stripping behavior.hn.apkfixture: DEX total size unchanged (3,122,393 bytes) with libraries correctly grouped.make checkpasses (lint/format/types).