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 class from another library makes my build fail #14

Closed
georgianst opened this issue Sep 10, 2019 · 11 comments
Closed

Duplicate class from another library makes my build fail #14

georgianst opened this issue Sep 10, 2019 · 11 comments

Comments

@georgianst
Copy link

georgianst commented Sep 10, 2019

Hi,
I also wrote an email to your support team regarding this but I thought it will a good idea to open an issue as well.

While trying to add the 3DS2 Android SDK to my project via maven repository, my build fails with the following errors:

Caused by: com.android.builder.dexing.DexArchiveBuilderException Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing. Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete Caused by: com.android.tools.r8.utils.AbortException: Error: Type org.a.a.d is referenced as an interface from org.a.a.a.

I am using version 2.1.0-rc04 of your library and my Gradle version is 3.3.2. While updating my Gradle version to 3.5.0 I was able to get a more explicit error message and it seems there is a conflict with another library I am using, com.applovin.mediation.sdks.fyber:ia-video-kit-release:7.1.7. The more detailed error is the following:

Duplicate class org.a.b.a.a found in modules classes.jar (:ia-video-kit-release-7.1.7:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)

I would also like to mention that if I downgrade to adyen-3ds2:0.9.6 my build is successful.

I also noticed that the only difference between adyen-3ds2:0.9.6 and adyen-3ds2:2.1.0-rc04 regarding dependencies is this library called io.michaelrocks.paranoid-core and I tried excluding this one but my build still fails.

So my question is, is there a module from 3ds2-2.1.0-rc04 that I can exclude in order to make my build successful or should I revert to 3ds2-2.1.0-0.9.6?

Thank you,
Georgian

@mshafrir-stripe
Copy link

mshafrir-stripe commented Sep 10, 2019

👋 stripe-android developer here, happy to help debug as well.

While updating my Gradle version to 3.5.0

R8 is enabled by default in Android Gradle Plugin 3.4.0 [0], and while R8 should generally work for you, some libraries do bytecode rewriting that is incompatible with R8 [1]. What version of Gradle are you using? You can find this in gradle-wrapper.properties.

We had to add the following in our 3DS2 SDK's gradle.properties to resolve this.

android.enableR8=false

Would you be able to share your dependencies configuration?

[0] https://developer.android.com/studio/releases/gradle-plugin#3-4-0
[1] https://issuetracker.google.com/issues/138337238

@timon-langlotz
Copy link

Hi @GorG1993,

first of all, 2.1.0-rc04 is currently the correct version to use.

Regarding your issue: my first assumption is that there's an issue with conflicting classes from Proguard / R8. It seems like both our Adyen SDK and com.applovin.mediation.sdks.fyber:ia-video-kit-release:7.1.7 are obfuscating a class to org.a.b.a.a, hence causing the conflict. There might be a Proguard / R8 setting to avoid this issue.

@mshafrir-stripe, thanks for your help to debug here! But did you confuse this with the Stripe SDK? 😅

Cheers,
TImon

@mshafrir-stripe
Copy link

@timon-langlotz oh man! I was checking out the Issues in your repo to see if there were any common issues that your users were seeing. Totally thought this was a question about integrating both Stripe and Adyen. 🤦‍♂ 🤦‍♂🤦‍♂

@peterzoosk
Copy link

I'm working with @GorG1993 on this and have been trying to figure this out.

@timon-langlotz I think you are right about both SDKs minifying to the same naming scheme. When I look at the aar of either of these SDKs they both have these org.a.a.a, org.a.a.b, etc packages in them.

Does a proguard rule need to be added to keep whatever library that originated from?

The full log details all of the conflicting classes:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':Zoosk:checkDebugDuplicateClasses'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:151)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:148)
	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:141)
	at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
	at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
	at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.ide.common.workers.WorkerExecutorException: 1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class org.a.a.a found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.a.b found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.a.c found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.a.d found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.a.e found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.a.f found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.b.a found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.b.a.a found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.b.a.b found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.b.a.c found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.b.b found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.b.c found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)
Duplicate class org.a.b.d found in modules classes.jar (:ia-video-kit-release-7.3.4:) and classes.jar (com.adyen.threeds:adyen-3ds2:2.1.0-rc04)```

@timon-langlotz
Copy link

timon-langlotz commented Sep 17, 2019

Hi @GorG1993,

Does a proguard rule need to be added to keep whatever library that originated from?

I'm unfortunately not aware of the a Proguard rule / config that would transform existing classnames an additional time to potentially resolve this issue on your side. But I will look into it!

The problem is that we don't know which dependencies our merchants will have in their projects, so we cannot know how to transform the classes, since anything might in theory conflict. But that is also something I can look into.

Cheers,
Timon

@timon-langlotz
Copy link

Hi @GorG1993 and @peterzoosk,

we've just published a new release that should fix this issue.

Cheers,
Timon

@parshwa1596
Copy link

in modules jetified-agora-rtc-sdk.jar (agora-rtc-sdk.jar) and jetified-full-sdk-3.0.0-runtime.jar (io.agora.rtc:full-sdk:3.0.0)
Duplicate class io.agora.rtc.video.WatermarkOptions found in modules jetified-agora-rtc-sdk.jar (agora-rtc-sdk.jar) and jetified-full-sdk-3.0.0-runtime.jar (io.agora.rtc:full-sdk:3.0.0)
Duplicate class io.agora.rtc.video.WatermarkOptions$Rectangle found in modules jetified-agora-rtc-sdk.jar (agora-rtc-sdk.jar) and jetified-full-sdk-3.0.0-runtime.jar (io.agora.rtc:full-sdk:3.0.0)

i used agora sdk for vedio calling and these type of error i shown what can i do?

@caiofaustino
Copy link

hey @parshwa1596 , you should update the 3DS2 SDK to at least version 2.1.0-rc05.

@night2tl
Copy link

night2tl commented Sep 3, 2020

@timon-langlotz I was wondering how you eventually solved it in code, as I'm also an SDK developer facing the same issues, if you could give me a hand here/direction, that would be fabulous!

@timon-langlotz
Copy link

We ended up using the flattenpackagehierarchy ProGuard option to move all our classes into a custom package. This does not guarantee the uniqueness of our package, but decreases the chance of a collision.

@night2tl
Copy link

night2tl commented Sep 6, 2020

Thanks, that helped me and solved my problem!

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

7 participants