Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ffmpeg-kit-react-native): fix Android build errors caused by duplicate libc++_shared.so #159

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

lachenmayer
Copy link
Contributor

Why

Fixes #31.

The root cause of this is the issue described in the ffmpeg-kit docs:

If a second library which also includes libc++_shared.so is added as a dependency, gradle fails with More than one file was found with OS independent path 'lib/x86/libc++_shared.so' error message.

This is currently breaking our build, so we're using patch-package to apply this diff.

How

Using expo/expo#15863, which allows us to define a android.packagingOptions.pickFirsts property in gradle.properties.

Note that this currently doesn't check if there are any other android.packagingOptions.pickFirsts properties - I'm not even sure what the behavior should be in general (should it be replaced, appended, ...?).

Test Plan

So far, this has only been tested by building our app on EAS, using patch-package to update the packages/ffmpeg-kit-react-native/build/withAndroidFFMPEGPackage.js file.

Before: the gradlew task fails with the following error:

[stderr] Execution failed for task ':app:mergeDebugNativeLibs'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
[stderr]    > 2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs:
[stderr] - /home/expo/.gradle/caches/transforms-3/2cc1c6bf49a4b55c6e81278f0aa6c079/transformed/jetified-react-native-0.70.5-debug/jni/arm64-v8a/libc++_shared.so
[stderr]       - /home/expo/.gradle/caches/transforms-3/2a1d5e98bc03f10f84a5b972b15ae4ac/transformed/jetified-ffmpeg-kit-https-gpl-5.1/jni/arm64-v8a/libc++_shared.so
[stderr]      If you are using jniLibs and CMake IMPORTED targets, see
[stderr]      https://developer.android.com/r/tools/jniLibs-vs-imported-targets
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.

After: build succeeds.

@eprice122
Copy link

I was seeing the same issue and this patch worked for me as well

@EvanBacon EvanBacon merged commit 0f41412 into expo:main Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android build error for ffmpeg-kit-react-native
3 participants