question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

duplicate entry error related to okhttp3 when integrating React Native into existing Android project

See original GitHub issue

Description

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:closed
  • Created 7 years ago
  • Reactions:13
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

10reactions
durboncommented, Mar 28, 2017

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

5reactions
lyahdavcommented, Mar 21, 2017

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.

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found