More than one file was found with OS independent path ‘lib/x86/libc++_shared.so’ React Native Error Fix

It’s usual to encounter unprecedented errors when you are using so many third-party libraries in your react native project. Recently I faced a build error when I tried to run a react native android app. Following is the error shown in the terminal.

Execution failed for task ‘:app:mergeDebugNativeLibs’.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
More than one file was found with OS independent path ‘lib/x86/libc++_shared.so’

react native error

I did a quick search on Google and fortunately, got the solution for this error.

I opened YourProject/android/app/build.gradle file and added the following snippet.

    packagingOptions {
    pickFirst '**/*.so'
    }

Make sure that you added the above lines inside the android tag.

Then I cleaned gradle using the following command.

cd android && ./gradlew clean

When I reran the project, the error was gone and the build was successful.

Similar Posts

Leave a Reply