duplicate entry error related to okhttp3 when integrating React Native into existing Android project
See original GitHub issueDescription
After adding React Native to an existing Android project, I get the following error when running ./gradlew assembleDebug
:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':driver:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: okhttp3/internal/ws/RealWebSocket$1.class
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
This project already had a dependency on okhttp3, so I’m not sure how to make Gradle ignore the React Native dependency on it.
Additional Information
- React Native version: 0.31
- Platform: Android
- Operating System: MacOS 10.11.6 (15G1217)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:13
- Comments:18 (12 by maintainers)
Top Results From Across the Web
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 ......
Read more >[SOLVED] Duplicated classes when building for Android
I'm getting lots of errors when I try to compile for Android. CommandInvokationFailure: Gradle build failed.
Read more >React Native security: SSL Pinning | by Yee Wong - ITNEXT
In this article, we will be looking at how to implement SSL Pinning in our React Native iOS and Android app to protect...
Read more >How to Integrate an Existing Android App with React Native
Firstly, create a folder named “android” and place your existing native application within that folder. Now create a 'package.json' within the ...
Read more >Unable to configure zoom video sdk in react native project
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I resolved that forcing for all my dependencies would be the same. I had already some dependencies using v3.5.0 and having the conflict with new okhttp-ws integrated into v3.5.0 🤦♂️
It’s a workaround. Be aware that with this one we cannot use v3.5.0.
configurations.all { resolutionStrategy.force 'com.squareup.okhttp3:okhttp:3.4.1' }
No fix yet. I haven’t had time to investigate further. Like I said above, also not sure if this belongs here or on my Stack Overflow question above.