Search code examples
javaandroidapachebuild.gradleopentok

getting an issue while archiving opentok audio/video chat


I am trying to configure audio/video chat and archive audio/video chat with OpenTok API. I have successfully configure audio/video chat with OpenTok but unable to perform archive.

Getting following issue:

Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.

java.util.zip.ZipException: duplicate entry: org/apache/commons/collections/ArrayStack.class

This is my library:

enter image description here

Following are my dependencies:

dependencies {

    //compile project(':androidConferenceWebRTC')
    compile project(':countryPicker')
    compile project(':customEmoji')
    compile project(':sugar')
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('com.crashlytics.sdk.android:crashlytics:2.2.3@aar') {
        transitive = true;
    }
    compile('com.twitter.sdk.android:twitter:1.3.2@aar') {
        transitive = true;
    }
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.pnikosis:materialish-progress:1.5'
    compile 'com.facebook.android:facebook-android-sdk:3.20.0'
    compile 'com.google.android.gms:play-services-base:7.0.0'
    compile 'com.google.android.gms:play-services-ads:7.3.0'
    compile 'com.google.android.gms:play-services-plus:7.0.0'
    compile 'com.google.code.gson:gson:2.3'
    compile 'org.apache.httpcomponents:httpcore:4.3.2'
    compile 'org.apache.httpcomponents:httpmime:4.3.3'
    compile 'org.jsoup:jsoup:1.8.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.pubnub:pubnub-android:3.7.2'
    compile 'com.splitwise:tokenautocomplete:1.3.2'
    compile 'com.mcxiaoke.volley:library:1.0.17'
    //compile files('libs/opentok-android-sdk.jar')
    compile 'com.tokbox:opentok-server-sdk:2.3.2'
    //compile files('libs/opentok-server-sdk-2.3.2-javadoc.jar')
}

This is my log:

enter image description here enter image description here


Solution

  • Replace:

    compile 'com.tokbox:opentok-server-sdk:2.3.2'
    

    With:

    compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '2.2.0'
    

    and Rebuild. This Should Solve your problem.

    Also, add this in your build.gradle file, if you have not already added them.

    packagingOptions {
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/notice.txt'        
            exclude 'META-INF/ASL2.0'
        }
    

    I hope you have this already in your build.gradle, if not than include it too

            **multiDexEnabled true**
    

    And compile 'com.android.support:multidex:1.0.0' in Dependencies.