psambit9791 / jdsp

A Java Library for Digital Signal Processing
https://jdsp.dev
MIT License
240 stars 45 forks source link

Duplicate class SafeThrowable or StackTraceWriter #11

Closed franck-serot closed 3 years ago

franck-serot commented 3 years ago

Hi I tried to use the jDSP 0.5.0 library in an Android projet. I added the dependencies : implementation('com.github.psambit9791:jdsp:0.5.0') But I had the following error :

Duplicate class org.apache.maven.surefire.report.SafeThrowable found in modules 
jetified-common-java5-2.19.1 (org.apache.maven.surefire:common-java5:2.19.1) and 
jetified-surefire-api-2.19.1 (org.apache.maven.surefire:surefire-api:2.19.1)
Duplicate class org.apache.maven.surefire.report.StackTraceWriter found in modules 
jetified-common-java5-2.19.1 (org.apache.maven.surefire:common-java5:2.19.1) and
jetified-surefire-api-2.19.1 (org.apache.maven.surefire:surefire-api:2.19.1)

I tried to exclude the dependencies with the following gradle configurations :

    implementation('com.github.psambit9791:jdsp:0.5.0') {
        exclude group: 'org.apache.maven.surefire', module: 'common-java5'
    }

or

    implementation('com.github.psambit9791:jdsp:0.5.0') {
        exclude group: 'org.apache.maven.surefire', module: 'surefire-api'
    }

But I add the following error :

Execution failed for task ':mylibrary:mergeDebugAndroidTestJavaResource'.
> 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/DEPENDENCIES'.

Could you please help me to solve this problem ? Best regards, Franck

psambit9791 commented 3 years ago

Refer to issue https://github.com/psambit9791/jDSP/issues/5

franck-serot commented 3 years ago

I tried to exclude the dependencies with the following gradle configurations :

implementation('com.github.psambit9791:jdsp:0.5.0') {
        exclude group: 'org.apache.maven.surefire', module: 'common-java5'
        exclude group: 'org.apache.maven.surefire', module: 'surefire-api'
    }

But I add the following error :

Execution failed for task ':mylibrary:mergeDebugAndroidTestJavaResource'.
> 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/DEPENDENCIES'.

I need to evaluate the jDSP library with AndroidTest module. Could you please help me to solve this problem ? Best regards, Franck

franck-serot commented 3 years ago

I found the solution. In the gradle file, add the following configuration in the android section :

packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE.md'
        exclude 'META-INF/LICENSE-notice.md'
    }