Duplicate class found after adding module in android studio

Viewed 558

When built differently, both of my projects operate perfectly. Now I'm integrating them into one, and I've included project-1 as a module to project-2.

Here is my Project 1 Gradle.

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'

android {
    compileSdkVersion 30
    //buildToolsVersion '26.1.0'
    defaultConfig {
        applicationId "com.avodigy.basememberpedia"
        minSdkVersion 24
        targetSdkVersion 30
        multiDexEnabled true
        versionCode 1
        versionName "1.0.1"
    }


    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }


    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
        test.java.srcDirs += 'src/test/kotlin'
    }

    android {
        lintOptions {
            checkReleaseBuilds false
            // Or, if you prefer, you can continue to check for errors in release builds,
            // but continue the build even when errors are found:
            abortOnError false
        }
    }



    task generateSourcesJar(type: Jar) {
        from android.sourceSets.main.java.srcDirs
        classifier 'sources'
    }

    task generateJavadocs(type: Javadoc) {
        source = android.sourceSets.main.java.srcDirs
        classpath += project.files(android.getBootClasspath()
                .join(File.pathSeparator))
    }

    task generateJavadocsJar(type: Jar) {
        from generateJavadocs.destinationDir
        classifier 'javadoc'
    }
    artifacts {
        archives generateJavadocsJar
        archives generateSourcesJar
    }

    aaptOptions {
        cruncherEnabled = false
    }

    buildTypes {
        release {
            debuggable false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            lintOptions {
                disable 'MissingTranslation'
                checkReleaseBuilds false
                abortOnError false
            }
        }
    }

    repositories {
        maven {
            url 'https://www.jitpack.io'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/spring.schemas'
        exclude 'META-INF/spring.tooling'
        exclude 'META-INF/INDEX.LIST'
        exclude 'META-INF/spring.handlers'
    }
    configurations {
        all*.exclude module: 'classworlds'
        all*.exclude module: 'commons-logging'
        all*.exclude module: 'httpclient'
        all*.exclude module: 'maven-artifact'
        all*.exclude module: 'maven-artifact-manager'
        all*.exclude module: 'maven-error-diagnostics'
        all*.exclude module: 'maven-model'
        all*.exclude module: 'maven-project'
        all*.exclude module: 'maven-settings'
        all*.exclude module: 'plexus-container-default'
        all*.exclude module: 'plexus-interpolation'
        all*.exclude module: 'plexus-utils'
        all*.exclude module: 'wagon-file'
        all*.exclude module: 'wagon-http-lightweight'
        all*.exclude module: 'wagon-provider-api'

    }



    dexOptions {
        javaMaxHeapSize "12g"
        incremental true
    }




    buildFeatures {
        dataBinding true
    }

    dexOptions {
        javaMaxHeapSize "6g"
        //preDexLibraries = false
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }

    configurations {
        all { // You should exclude one of them not both of them
            exclude group: "com.android.support", module: "support-core-ui"
            exclude group: "com.android.support", module: "support-compat"
        }
    }



}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.2.0'

    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.cardview:cardview:1.0.0'

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.parse:parse-android:1.15.8'
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'



    //SDP for APP UI
    implementation 'com.intuit.sdp:sdp-android:1.0.6'
    implementation 'com.intuit.ssp:ssp-android:1.0.6'
    
    implementation 'com.google.code.gson:gson:2.8.6'

    implementation 'com.isseiaoki:simplecropview:1.1.4'

    implementation 'ly.count.android:sdk:20.11.10'

    implementation 'com.google.android.gms:play-services-gcm:17.0.0'

    implementation platform('com.google.firebase:firebase-bom:25.12.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-messaging'

    implementation 'org.apache.commons:commons-lang3:3.4'

    //Todo SendBird Chat
    implementation "com.sendbird.sdk:uikit:2.2.2"

    // Todo Sendbird Call
    implementation 'com.sendbird.sdk:sendbird-calls:1.7.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'

    //Todo Kotlin Support
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'

    implementation "com.google.firebase:firebase-crashlytics:$firebaseCrashlyticsVersion"
    implementation "com.google.firebase:firebase-perf:$firebasePerformanceVersion"

    implementation 'com.google.firebase:firebase-dynamic-links-ktx:19.1.0'
    implementation 'com.google.firebase:firebase-analytics-ktx:17.5.0'


    implementation group: 'com.googlecode.plist', name: 'dd-plist', version: '1.3'

    implementation 'com.google.firebase:firebase-firestore:21.6.0'
    implementation 'com.firebaseui:firebase-ui-firestore:6.2.1'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.google.firebase:firebase-storage:19.2.0'
    implementation 'com.google.firebase:firebase-database:20.0.4'

    implementation 'com.asksira.android:bsimagepicker:1.1.0'
    implementation "io.coil-kt:coil:0.9.5"

    implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
    implementation 'com.google.firebase:firebase-auth'


    //Todo Manish Code to integrate EventpediaBase
    implementation project(':eventpediaBase')

    implementation files('libs/achartengine-1.1.0.jar')
    implementation files('libs/commons-io-2.4.jar')
    implementation files('libs/universal-image-loader-1.9.0.jar')
    implementation files('libs/org-apache-commons-codec.jar')
    implementation files('libs/twitter4j-core-4.0.2.jar')
    implementation files('libs/YouTubeAndroidPlayerApi.jar')
    implementation files('libs/socialauth-4.4.jar')
    implementation files('libs/picasso-2.5.0.jar')
    implementation files('libs/pinch-0.8.jar')
}

ext {
    libraryName = 'FirebaseApp'
    artifact = 'firebase-app'
    libraryDescription = 'Firebase App'
}

Project 2 Gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'  // Google Services plugin
android {
    compileSdkVersion 31

    defaultConfig {
        applicationId "com.avodigy.eventpediabeta"
        minSdkVersion 17
        targetSdkVersion 31
        // Enabling multidex support.
        multiDexEnabled true
//        compileOptions {
//            sourceCompatibility JavaVersion.VERSION_1_7
//            targetCompatibility JavaVersion.VERSION_1_7
//        }

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    lintOptions {
        abortOnError false
    }
//    packagingOptions {
//        exclude 'META-INF/DEPENDENCIES.txt'
//        exclude 'META-INF/LICENSE.txt'
//        exclude 'META-INF/NOTICE.txt'
//        exclude 'META-INF/NOTICE'
//        exclude 'META-INF/LICENSE'
//        exclude 'META-INF/DEPENDENCIES'
//        exclude 'META-INF/notice.txt'
//        exclude 'META-INF/license.txt'
//        exclude 'META-INF/dependencies.txt'
//        exclude 'META-INF/LGPL2.1'
//    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildFeatures {
        dataBinding true
    }


    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/spring.schemas'
        exclude 'META-INF/spring.tooling'
        exclude 'META-INF/INDEX.LIST'
        exclude 'META-INF/spring.handlers'
    }
    configurations {
        all*.exclude module: 'classworlds'
        all*.exclude module: 'commons-logging'
        all*.exclude module: 'httpclient'
        all*.exclude module: 'maven-artifact'
        all*.exclude module: 'maven-artifact-manager'
        all*.exclude module: 'maven-error-diagnostics'
        all*.exclude module: 'maven-model'
        all*.exclude module: 'maven-project'
        all*.exclude module: 'maven-settings'
        all*.exclude module: 'plexus-container-default'
        all*.exclude module: 'plexus-interpolation'
        all*.exclude module: 'plexus-utils'
        all*.exclude module: 'wagon-file'
        all*.exclude module: 'wagon-http-lightweight'
        all*.exclude module: 'wagon-provider-api'

    }


}

dependencies {
    implementation 'com.parse:parse-android:1.15.8'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'net.sf.opencsv:opencsv:2.3'
    implementation 'ly.count.android:sdk:20.11.10'
    implementation 'com.isseiaoki:simplecropview:1.1.4'
    implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.0'
    implementation 'me.dm7.barcodescanner:zbar:1.8.4'
    implementation 'com.google.maps.android:android-maps-utils:0.4.3'
    implementation 'com.vanniktech:emoji-ios:0.5.1'
    implementation 'org.apache.commons:commons-lang3:3.4'
    implementation 'org.zakariya.stickyheaders:stickyheaders:0.7.6'
    implementation 'com.wang.avi:library:2.1.3'
    implementation group: 'com.pubnub', name: 'pubnub-gson', version: '4.19.0'
    implementation 'com.github.alamkanak:android-week-view:1.2.6'



    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.android.gms:play-services-base:17.4.0'
    implementation 'com.google.android.gms:play-services-location:17.1.0'
    implementation 'com.google.firebase:firebase-messaging:20.3.0'
    implementation 'com.google.firebase:firebase-core:17.5.1'


    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.2.0'

    implementation 'androidx.fragment:fragment:1.4.0-alpha03'
    
    implementation 'androidx.core:core:1.3.2'


    //Todo SendBird Chat
    implementation "com.sendbird.sdk:uikit:2.2.2"

    // Todo Sendbird Call
    implementation 'com.sendbird.sdk:sendbird-calls:1.7.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.2'// [Calls]

    implementation files('libs/achartengine-1.1.0.jar')
    implementation files('libs/android_sdk_1.0.1.jar')
    implementation files('libs/AndroidAgent-1.5.jar')
    implementation files('libs/commons-io-2.4.jar')
    implementation files('libs/core-2.0.jar')
    implementation files('libs/core-sdk-1.0.1.jar')
    implementation files('libs/itextpdf-5.0.6.jar')
    implementation files('libs/picasso-2.5.0.jar')
    implementation files('libs/pinch-0.8.jar')
    implementation files('libs/signpost-commonshttp4-1.2.1.2.jar')
    implementation files('libs/signpost-core-1.2.1.2.jar')
    implementation files('libs/signpost-jetty6-1.2.1.2.jar')
    implementation files('libs/socialauth-4.4.jar')
    implementation files('libs/socialauth-android-3.2.jar')
    implementation files('libs/twitter4j-core-4.0.2.jar')
    implementation files('libs/universal-image-loader-1.9.0.jar')
    implementation files('libs/YouTubeAndroidPlayerApi.jar')
    implementation files('libs/org-apache-commons-codec.jar')

}

Gradle Error:

Duplicate class com.google.gdata.util.common.base.Escaper found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class com.google.gdata.util.common.base.PercentEscaper found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class com.google.gdata.util.common.base.Preconditions found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class com.google.gdata.util.common.base.UnicodeEscaper found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class com.google.gdata.util.common.base.UnicodeEscaper$1 found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class com.google.gdata.util.common.base.UnicodeEscaper$2 found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.AbstractOAuthConsumer found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.AbstractOAuthProvider found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.OAuth found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.OAuthConsumer found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.OAuthProvider found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.OAuthProviderListener found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.basic.DefaultOAuthConsumer found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.basic.DefaultOAuthProvider found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.basic.HttpURLConnectionRequestAdapter found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.basic.HttpURLConnectionResponseAdapter found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.basic.UrlStringRequestAdapter found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.exception.OAuthCommunicationException found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.exception.OAuthException found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.exception.OAuthExpectationFailedException found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.exception.OAuthMessageSignerException found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.exception.OAuthNotAuthorizedException found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.http.HttpParameters found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.http.HttpRequest found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.http.HttpResponse found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.signature.AuthorizationHeaderSigningStrategy found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.signature.HmacSha1MessageSigner found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.signature.OAuthMessageSigner found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.signature.PlainTextMessageSigner found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.signature.QueryStringSigningStrategy found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.signature.SignatureBaseString found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)
Duplicate class oauth.signpost.signature.SigningStrategy found in modules jetified-signpost-core-1.2.1.1.jar (signpost-core-1.2.1.1.jar) and jetified-signpost-core-1.2.1.2.jar (signpost-core-1.2.1.2.jar)

Go to the documentation to learn how to Fix dependency resolution errors.

I've read on other threads on stack overflow about using the exclude:group in your build.gradle it's just that i seem to be doing something wrong. Can someone please tell me (i) how to add the exlude statement to the fix the error above instead of giving some generic example (ii) how would i manually remove the modules causing the duplication? (i've tried by removing them from the gradle cache folder even deleted the .gradle folder but it keeps rebuilding it). Any suggestion would be appreciated.

0 Answers
Related