Duplicate files copied in APK error when integrating with existing Android project
See original GitHub issueI’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:
- Created 7 years ago
- Reactions:2
- Comments:8 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
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 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.
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