Duplicate entry: okhttp3/internal/ws/RealWebSocket$1.class

╄→尐↘猪︶ㄣ 提交于 2019-12-12 12:45:45

问题


I am using LeanCloud as my push notification service provider but somehow when I run my app it gives me this error. Below is my dependencies:

dependencies {
    compile 'com.android.support:multidex:1.0.1'
    compile project(':react-native-push-notification')
    compile project(':react-native-svg')
    compile project(':react-native-fbsdk')
    compile project(':react-native-picker')
    compile project(':react-native-maps')
    compile project(':react-native-wechat')
    compile project(':react-native-code-push')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile ("com.android.support:appcompat-v7:23.0.1")
    compile ("com.facebook.react:react-native:+")  // From node_modules
    compile ('com.facebook.android:facebook-android-sdk:[4.22.1)')
    compile ('cn.leancloud.android:avoscloud-sdk:v4.4.4')
    compile ('cn.leancloud.android:avoscloud-push:v4.4.4@aar'){
        transitive = true
    }
}

The exact error message:

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

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: okhttp3/internal/ws/RealWebSocket$1.class

I have tried to add "exclude group: 'com.squareup.okhttp3', module: 'okhttp'". It allows me to run the app but somehow I can't register my device on LeanCloud server.

I am stuck in this problem for so long. Thanks for any help or suggestions.


回答1:


you can add this in your app.gradle

configurations.all {
        // OkHttp 3.5.0+ includes the websockets API, so we need this to prevent a conflict
        exclude module: 'okhttp-ws'
}

it may help you! https://github.com/facebook/react-native/issues/12646



来源:https://stackoverflow.com/questions/46178026/duplicate-entry-okhttp3-internal-ws-realwebsocket1-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!