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

fix: issue 1994 #2000

Merged
merged 2 commits into from
Jan 30, 2019
Merged

fix: issue 1994 #2000

merged 2 commits into from
Jan 30, 2019

Conversation

vbarthel-fr
Copy link
Contributor

@vbarthel-fr vbarthel-fr commented Jan 29, 2019

I have separated the changes into two commits:

brut.androlib.decode.DecodeArrayTest > decodeStringArray FAILED
    junit.framework.AssertionFailedError: Not a ResArrayValue. Found: class brut.androlib.res.data.value.ResStyleValue
        at junit.framework.Assert.fail(Assert.java:50)
        at junit.framework.Assert.assertTrue(Assert.java:20)
        at brut.androlib.decode.DecodeArrayTest.decodeStringArray(DecodeArrayTest.java:42)

brut.androlib.decode.DecodeArrayTest > decodeArray FAILED
    junit.framework.AssertionFailedError: Not a ResArrayValue. Found: class brut.androlib.res.data.value.ResStyleValue
        at junit.framework.Assert.fail(Assert.java:50)
        at junit.framework.Assert.assertTrue(Assert.java:20)
        at brut.androlib.decode.DecodeArrayTest.decodeArray(DecodeArrayTest.java:53)

141 tests completed, 2 failed
  • the second commit adds the actual fix. The tests are now passing!

Note: for now I have kept the previous check on the id of the first item within the bag.
Note: I'm not 100% sure that the same technique could be applied to the attr resources. For now, only the style, plurals, and array have a new check on the res type spec name.

Starting with the version 28.0.3 of the Android SDK build tools,
the internal ids of the items of an array bag seems to have changed.

Because of those changes, array resources were no longer decoded correctly.
They were decoded as style resources.

Instead of using the id of the first item within a resource bag,
the name of the res type spec is now used to choose the correct
resource bag value to create.

Note: a list of "legal names" for resource types  can be found in the source code of aapt2.
@vbarthel-fr vbarthel-fr changed the title Fix: Issue 1994 fix: issue 1994 Jan 29, 2019
@iBotPeaches
Copy link
Owner

Lucky #2000 :)

Everything looks good. If you wouldn't mind pushing the example app source code here - https://github.com/iBotPeaches/TestApks

Allows me to easily rebuild those applications if needed

@vbarthel-fr
Copy link
Contributor Author

Sure! Here is the PR for the source code of the test apk: iBotPeaches/TestApks#2

@iBotPeaches iBotPeaches merged commit 43c3b96 into iBotPeaches:master Jan 30, 2019
@iBotPeaches
Copy link
Owner

Thanks for the PR and very detailed commits. Makes it real easy for me!

@vbarthel-fr vbarthel-fr deleted the issue-1994 branch January 30, 2019 16:13
@vbarthel-fr
Copy link
Contributor Author

You're welcome :) Thanks a lot for all the work you have put into this project!

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

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.

array parsing in resources
2 participants