Shopify / unity-buy-sdk

The Unity Buy SDK allows Unity developers to query and sell products from Shopify directly in Unity.
https://help.shopify.com/api/sdks/custom-storefront/unity-buy-sdk
MIT License
67 stars 23 forks source link

java.util.zip.ZipException: duplicate entry: android/support/annotation/RequiresPermission.class when using SDK #310

Closed sleroux closed 7 years ago

sleroux commented 7 years ago

When bringing the SDK into a large project with other native plugins, the project will produce the following Gradle error:

Execution failed for task ':transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/RequiresPermission.class

Currently we link in the support-annotations library when we build our instrument tests for the shopify_buy_plugin .AAR we generate:

https://github.com/Shopify/unity-buy-sdk/blob/beta/android/shopify_buy_plugin/build.gradle#L29

The issue is potentially caused by other .AARs/.JARs that link in differing versions of the same library causing duplicate entries to be added to project's classes.jar. Google has a plugin that we might be able to use to break this dependency management issue across plugins:

https://github.com/googlesamples/unity-jar-resolver#plugin-redistribution

sleroux commented 7 years ago

Note: This seems to only be an issue with multidex builds when building release variants.