Skip to content

fix: handle Android SDK codenames in permission loading - #8

Merged
ping2A merged 1 commit into
androguard:mainfrom
tshivaneshk:fix/issue-3-sdk-codename
Sep 28, 2026
Merged

ping2A merged 1 commit into
androguard:mainfrom
tshivaneshk:fix/issue-3-sdk-codename

Conversation

@tshivaneshk

Copy link
Copy Markdown
Contributor

Summary

Fix APK parsing failures when targetSdkVersion or related SDK values are Android preview codenames rather than numeric API levels.

Problem

apk-parser passes SDK codename strings such as Q to permission resource loading, where they are converted using int(). This raises ValueError and prevents the APK from being parsed successfully.

Changes

  • Add centralized SDK codename/API-level resolution.
  • Preserve existing integer and numeric-string behavior.
  • Handle unknown SDK values using the existing fallback model with an appropriate warning.
  • Reuse the resolver for affected permission SDK comparisons.
  • Add regression tests for numeric values, Android codenames, invalid values, and fallback behavior.

Verification

Scope

The change is limited to SDK-level resolution and the affected permission-loading path. Existing permission resource selection behavior is preserved.

Fixes #3

@ping2A
ping2A merged commit 7a0ad52 into androguard:main Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parsing APK crashes if targetSdkVersion is set to a string value

2 participants