重复条目:okhttp3/internal/ws/RealWebSocket$1.class [英] Duplicate entry: okhttp3/internal/ws/RealWebSocket$1.class

查看:92
本文介绍了重复条目:okhttp3/internal/ws/RealWebSocket$1.class的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 LeanCloud 作为我的推送通知服务提供商,但不知何故,当我运行我的应用程序时,它给了我这个错误.以下是我的依赖项:

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
    }
}

确切的错误信息:

错误:任务:app:transformClassesWithJarMergingForDebug"的执行失败.

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

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:okhttp3/internal/ws/RealWebSocket$1.class

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

我尝试添加排除组:'com.squareup.okhttp3',模块:'okhttp'".它允许我运行应用程序,但不知何故我无法在 LeanCloud 服务器上注册我的设备.

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.

推荐答案

你可以在你的 app.gradle 中添加这个

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'
}

它可以帮助你!https://github.com/facebook/react-native/issues/12646

这篇关于重复条目:okhttp3/internal/ws/RealWebSocket$1.class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆