How to refine which binaries are packaged in an Android build?

I'm trying to work out how to explicitly select which binary files are included in the .apk produced by an Android gradle build.

I have a project whose dependencies have different versions of the file libc++_shared.so. This causes a conflict when packaging the build output, because cradle doesn't know which file to select.

However, the pickFirst packaging option selects the 'wrong' copy of the file. That is, dependency A and dependency B both include the file. I know that I want the version that dependency A comes with, but if I include the following config in build.gradle to make sure the build runs:

packagingOptions {
   pickFirst('lib/x86/libc++_shared.so')
}

it's always the copy from dependency B that gets packaged.

What I'd really like to do is exclude the file from B. I can see in the gradle documentation and examples online how to exclude a transitive dependency, but not an embedded binary in this way.

The two dependencies in question are:

React Native 0.59.2 MyScript iink 1.3.0 (http://myscript.com)

In my top-level build.gradle, the dependencies are included as:

dependencies {
    // From node_modules
    implementation 'com.facebook.react:react-native:+'
    // MyScript iink dependency is transitive through this 
    implementation project(path: ':UIReferenceImplementation')
}

Is there a way to specify exactly which copy of libc++_shared.so I want to package, either by naming it, or by excluding the copy that I don't want?