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 files copied in APK error when integrating with existing Android project

See original GitHub issue

I’m trying to add React Native to an existing Android project using Gradle. I followed the instructions here: https://facebook.github.io/react-native/docs/integration-with-existing-apps.html

When I try to run my app from Android Studio I get this error:

> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/armeabi-v7a/libgnustl_shared.so
    File1: .../build/intermediates/exploded-aar/com.facebook.react/react-native/0.20.1/jni
    File2: .../build/intermediates/exploded-aar/com.spotify/spotify-player/1.0.0-beta12/jni

It looks like both React Native and the Spotify dependencies require the same file: libgnustl_shared.so.

There is a Stack Overflow post with a hacky fix for this, but I’m guessing there should be a more elegant solution than this: http://stackoverflow.com/a/37201791/62

It would be nice to document the solution for this in the React Native page I linked above, as this could happen to many people when first trying to integrate React Native.

I’m on Mac OS X 10.11.6.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lyahdavcommented, Sep 20, 2016

I was able to resolve this and documented my solution here: http://stackoverflow.com/a/39584838/62

It would be nice if React Native could solve this though.

0reactions
EflakeEvercommented, Oct 31, 2017

Finally i found the mistake cause by the step of re-zip, I should re-zip all files instead of outer folder, it was success now, thanks for you help @lyahdav

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate files during packaging of APK app-debug-unaligned ...
Duplicate files during packaging of APK app-debug-unaligned.apk · httpclient-4.3.5.jar · httpmime-4.3.5.jar. into the libs folder after Sync with Gradle and Run .
Read more >
Configure build variants | Android Developers
Error : All flavors must now belong to a named flavor dimension. ... When you build an APK or AAB for your app,...
Read more >
Deploying Kanzi applications to Android - Rightware
Extract the Kanzi Android platform package zip file to the <KanziWorkspace> directory. When you extract the zip file, skip duplicate files instead of ......
Read more >
Duplicate Resources Error In Android Studio - Fixed - YouTube
Coding Moody goes Off when you frequently encounter some errors !We CodingTony channel here we are to help you fix some common android...
Read more >
Step 2: Add App Information | App Submission and Testing
Error: Duplicate package name; Warning: Reduced device support; Target device not available ... Upload an Android App Bundle (AAB) or an APK file....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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