Fix Apktool resource decoding bugs#17
Open
Sleeeee wants to merge 3 commits into
Open
Conversation
Author
|
Error 1 fix was merged in Apktool, so catching this error might not be needed anymore. Maybe it's still relevant to match error patterns even though they're not supposed to appear ? |
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.
On obfuscated APKs, Apktool will struggle with resource decoding and throw different kinds of errors, which propagate to patch-apk when trying to rebuild an APK. We can catch the error logs and fix them programmatically, and re-run the build command.
Error 1 : namespacing error
See this issue for details about this error. Basically, it assigns the
android:namespace to properties that should be assignedapp:.From patch-apk, we can retrieve the filename and attribute that caused the error, then remove the
android:prefix.Error 2 : duplicate attributes
We can match duplicates inside their files with a regex and keep only one occurence.
Error 3 : incompatible flags
Enumerations with no actual value will be decoded as an invalid
0x0value. We can remove this attribute completely.Example output on a test app: