Android 项目运行/打包报错: duplicate entry: okhttp3/internal/ws/RealWebSocket$1.class

Android 项目运行/打包报错:
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

问题点:
okhttp3包版本冲突

解决方案:

在app.gradle中添加如下配置:

configurations.all {

// OkHttp 3.5.0+ includes the websockets API, so we need this to prevent a conflict

    exclude module: 'okhttp-ws'

}

你可能感兴趣的:(Android 项目运行/打包报错: duplicate entry: okhttp3/internal/ws/RealWebSocket$1.class)