我使用leancloud作为推送通知服务提供商,但是当我运行我的应用程序时,不知怎么的,它给了我这个错误。以下是我的依赖关系:

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”的执行失败。
com.android.build.api.transform.transformexception:java.util.zip.zipeexception:重复条目:okhttp3/internal/ws/realwebsocket$1.class
我试图添加“exclude group:'com.squareup.okhttp3',module:'okhttp'”。它允许我运行应用程序,但不知何故我无法在leancloud服务器上注册我的设备。
我陷入这个问题太久了。谢谢你的帮助和建议。

最佳答案

你可以将此添加到你的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

关于android - 重复条目:okhttp3/internal/ws/RealWebSocket $ 1.class,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46178026/

10-08 23:35