Tribler/trustchain-superapp

Duplicate class when building

PraveshMoelchand opened this issue · 3 comments

When trying to build the dao branch, the following error pops up:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.goterl.lazycode.lazysodium.LazySodium found in modules jetified-lazysodium-android-4.1.0-runtime.jar (com.goterl.lazycode:lazysodium-android:4.1.0) and jetified-lazysodium-java-4.2.4.jar (com.goterl.lazycode:lazysodium-java:4.2.4)

// A lot of these exceptions go here..

  Duplicate class com.sun.jna.win32.W32APITypeMapper$2 found in modules jetified-jna-5.5.0-runtime.jar (net.java.dev.jna:jna:5.5.0) and jetified-jna-5.5.0.jar (net.java.dev.jna:jna:5.5.0)
  
  Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > More than one file was found with OS independent path 'META-INF/AL2.0'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 32s

Some people are able to build everything without problems, some people are not.
It seems that the error has been introduced in the following commit and is cause by the lines api project(':ipv8') and implementation "com.goterl.lazycode:lazysodium-java:4.2.4"

We have tried everything from using a .zip from the people who get it working to deleting all gradle folders, but nothing worked

Have you tried to remove the mentioned lines? I think ipv8 dependency is redundant as it is included in ipv8-android, and lazysodium-java should not be included, as libsodium-android is already included by ipv8-android.

I have just removed those two lines (cbe309f), please let me know if that fixed it for you.