decoder: Extend "keep-broken-res" to also ignore duplicate resources #1164

Merged
merged 1 commit into from Feb 16, 2016

Conversation

Projects
None yet
2 participants
@crpalmer
Contributor

crpalmer commented Feb 15, 2016

If I decode the framework-res.apk from the recent release of the Huawei Honor 5x I get this exception:

Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x01040384 string/lockscreen_carrier_default, config=[DEFAULT]
    at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:63)
    at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:56)
    at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:223)
    at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:191)
    at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:159)
    at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:116)
    at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:78)
    at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:47)
    at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:544)
    at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:63)
    at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:55)
    at brut.androlib.Androlib.getResTable(Androlib.java:65)
    at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:197)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:96)
    at brut.apktool.Main.cmdDecode(Main.java:165)
    at brut.apktool.Main.main(Main.java:81)

It seems to me like --keep-broken-res should also continue processing after this error. This pull request changes the code to do so.

@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Feb 15, 2016

Owner

Originally I had held off with a change like this, because users abused it anytime a decompilation failed, then would complain why a rebuild wouldn't work.

It never occurred to me to move this functionality into --keep-broken-res, which is already an advanced parameter. Thanks for the PR, will merge it in.

Owner

iBotPeaches commented Feb 15, 2016

Originally I had held off with a change like this, because users abused it anytime a decompilation failed, then would complain why a rebuild wouldn't work.

It never occurred to me to move this functionality into --keep-broken-res, which is already an advanced parameter. Thanks for the PR, will merge it in.

@iBotPeaches iBotPeaches merged commit 4a02f53 into iBotPeaches:master Feb 16, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@iBotPeaches

This comment has been minimized.

Show comment
Hide comment
@iBotPeaches

iBotPeaches Feb 16, 2016

Owner

Thanks!

Owner

iBotPeaches commented Feb 16, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment