Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAPT bug: enum/flag attr in a secondary framework #2002

Open
IgorEisberg opened this issue Jan 30, 2019 · 1 comment
Open

AAPT bug: enum/flag attr in a secondary framework #2002

IgorEisberg opened this issue Jan 30, 2019 · 1 comment

Comments

@IgorEisberg
Copy link
Contributor

IgorEisberg commented Jan 30, 2019

Information

  1. Apktool Version: 2.3.4, 2.4.0-SNAPSHOT
  2. Operating System: Linux, Windows
  3. APK From: Wrote the bug sample myself

Stacktrace/Logcat

$ java -jar apktool.jar b -f framework2 -o framework2.apk
I: Using Apktool 2.4.0-896569-SNAPSHOT
W: Could not find sources
I: Building resources...
I: Building apk file...
I: Built apk...

$ java -jar apktool.jar if framework2.apk -p framework
I: Framework installed to: framework/2.apk

$ java -jar apktool.jar b -f -p framework app -o app.apk
I: Using Apktool 2.4.0-896569-SNAPSHOT
W: Could not find sources
I: Building resources...
W: W/ResourceType(18083): DynamicRefTable(0x02): No mapping for build-time package ID 0x02.
W: W/ResourceType(18083): e[0x01] -> 0x01
W: W/ResourceType(18083): e[0x7f] -> 0x7f
W: E/ResourceType(18083): Failed resolving ResTable_map name at 116 with ident 0x02030000
W: warning: Package not found for resource #02010000
W: W/ResourceType(18083): No known package when getting value for resource number 0x01010000
W: W/ResourceType(18083): Invalid package identifier when getting bag for resource number 0x01010000
I: Building apk file...
I: Built apk...

Steps to Reproduce

This can only be reproduced by using an attr of "enum" or "flag" format that's defined in a secondary framework (forcedPackageId > 0x01) inside an app and then trying to recompile the app against the secondary framework.

  • The error seems to disappear when forcedPackageId is set to '1' for the secondary framework.
  • The error seems to disappear when the enum/flag valid value list is empty.
  • This doesn't happen with any other format of attr (reference, string, integer, boolean, color, float, dimension, fraction).

Sample

This tiny zip is a super-minimalist way to reproduce the issue:
https://www.mediafire.com/file/zri2n3nm30sqhq8/AaptAttrBug.zip/file

@IgorEisberg IgorEisberg changed the title Serious AAPT bug: enum/flag attr in a secondary framework Apktool/AAPT bug: enum/flag attr in a secondary framework Jan 30, 2019
@IgorEisberg IgorEisberg changed the title Apktool/AAPT bug: enum/flag attr in a secondary framework AAPT bug: enum/flag attr in a secondary framework Jan 30, 2019
@iBotPeaches
Copy link
Owner

Thanks for the detailed investigation. Guess we have a low level issue in our forced packageId patch. We need to handle the mapping of the dynamic reference table.

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

No branches or pull requests

2 participants