我正在运行gradle命令:./gradlew assembleRelease assembleAndroidTest
,但失败并出现以下错误:
> Task :react-native-ffmpeg:mergeDebugAndroidTestNativeLibs FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-ffmpeg:mergeDebugAndroidTestNativeLibs'.
> 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'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake
我按照here的说明进行操作,并将此代码添加到build.gradle
中: packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
}
但是,这些packagingOptions
似乎没有任何区别。我应该注意,仅运行assembleRelease
是可行的,只有当我在assembleAndroidTest
中添加时,才存在问题。我在react-native-ffmpeg github上有一个issue打开,但这似乎是更一般的gradle / android问题,这就是为什么我在这里发布。 最佳答案
如果在gradle任务前添加app:
,该错误就会消失。这是对我有用的构建命令:./gradlew app:assembleRelease app:assembleAndroidTest
。
关于android - React Native ./gradlew assembleRelease assembleAndroidTest失败: “More than one file found with OS independent path”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/63233876/