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

Duplicate assets in asset modules no longer permitted. #181

Closed
simon-bond opened this issue Sep 17, 2020 · 3 comments
Closed

Duplicate assets in asset modules no longer permitted. #181

simon-bond opened this issue Sep 17, 2020 · 3 comments

Comments

@simon-bond
Copy link

Describe the bug
As of v1.2.0, duplicate assets are no longer permitted.

I can see that this behaviour has been changed because resources in asset modules are uncompressed, whereas in features modules these are compressed. Can this check in bundletool only reject a collision where a clash occurs between an asset module and a feature module? It seems to me that if this resource only exists in asset modules, then there is no ambiguity between compressed or uncompressed. Please correct me if I've misunderstood. I've got an app out in the wild which was processed by the Play Store by an earlier version of bundletool that I now can't easily update.

Bundletool version(s) affected
Version: 1.2.0

Stacktrace

[BT:1.2.0] Error: Both modules 'module1' and 'module2' contain asset entry 'assets/img123.webp'.
com.android.tools.build.bundletool.model.exceptions.InvalidBundleException: Both modules 'module1' and 'module2' contain asset entry 'assets/img123.webp'.
        at com.android.tools.build.bundletool.model.exceptions.UserExceptionBuilder.build(UserExceptionBuilder.java:58)
        at com.android.tools.build.bundletool.validation.EntryClashValidator.checkEntryClash(EntryClashValidator.java:85)
        at com.android.tools.build.bundletool.validation.EntryClashValidator.lambda$checkEntryClashes$0(EntryClashValidator.java:64)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
        at java.base/java.util.stream.IntPipeline$1$1.accept(IntPipeline.java:180)
        at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104)
        at java.base/java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:699)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
        at com.google.common.collect.CollectSpliterators$1WithCharacteristics.forEachRemaining(CollectSpliterators.java:65)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
        at com.android.tools.build.bundletool.validation.EntryClashValidator.checkEntryClashes(EntryClashValidator.java:60)
        at com.android.tools.build.bundletool.validation.EntryClashValidator.validateAllModules(EntryClashValidator.java:51)
        at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleModulesUsingSubValidator(ValidatorRunner.java:75)
        at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleUsingSubValidator(ValidatorRunner.java:69)
        at com.android.tools.build.bundletool.validation.ValidatorRunner.lambda$validateBundle$3(ValidatorRunner.java:58)
        at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406)
        at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundle(ValidatorRunner.java:58)
        at com.android.tools.build.bundletool.validation.AppBundleValidator.validate(AppBundleValidator.java:104)
        at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:607)
        at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:75)
        at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:47)

To Reproduce
Create two bundles with a duplicate asset. Run build-apks

Expected behavior
Duplicate asset names are permitted if file contents are identical and asset only exists in asset modules.

@ymakhno
Copy link

ymakhno commented Sep 17, 2020

Thank you for reporting this, will fix in the next release. Could you please share your usecase, why do you need the same file between different asset modules?

@simon-bond
Copy link
Author

We have a large database of image assets for use in a battery of cognitive tests. Assets packs are downloaded for specific instances of a given task. Some images are reused between different types of tasks and consequently exist in different asset packs. Alternative strategies exist, but would be quite an upheaval for our asset generation mechanism (which is shared with a parallel implementation on iOS, where overlapping asset tags are permitted).

@ymakhno
Copy link

ymakhno commented Oct 15, 2020

Fixed in 1.3.0.

@ymakhno ymakhno closed this as completed Oct 15, 2020
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