我的react原生应用程序运行正常,但突然开始出现错误:
错误1:Execution failed for task ':react-native-webview:compileDebugKotlin'.
因此,在android/build.gradle中,我添加了kotlinVersion = "1.5.31"
,并添加了依赖项classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
。
在此之后,我得到了以下错误:
* What went wrong:
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/arm64-v8a/libfbjni.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
对于这一点,在android下的android/app/build.gradle中{...}我添加了:
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libjsc.so'
pickFirst 'lib/arm64-v8a/libjsc.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libfbjni.so'
}
但即使在这之后,我还是再次得到同样的错误:More than one file was found with OS independent path 'lib/arm64-v8a/libfbjni.so'
7条答案
按热度按时间d8tt03nd1#
您可以在
app/build.gradle
中添加给定的代码。我通过添加以下代码解决了我的错误。添加
pickFirst '**/libfbjni.so'
后,我又得到了两个错误,所以我添加了pickFirst '**/llibturbomodulejsijni.so'
和pickFirst '**/libturbomodulejsijni.so'
来解决我的错误。如果您的应用程序在打开时崩溃,则在
android/build.gradle
中添加以下内容ql3eal8s2#
在 android〉build.gradle 文件中添加以下行-
此问题发生于2022年11月4日。请参见参考:https://github.com/facebook/react-native/issues/35210
8yoxcaq73#
尝试将此代码添加到您的app build.gradle中的所有项目-〉存储库下:
将您的代码与gradle同步并再次运行。
exdqitrt4#
我的应用程序是在版本0.68.2和我更新到新版本0.68.5和它的工作。这个问题是发生在04/十一月/2022后发现版本在此职位GitHub
uxh89sit5#
基于@BK52提到的github线程,我将此代码段添加到
app/build.gradle
中它对我起作用了,错误似乎消失了。我正在使用RN 0. 68. 2。
1cosmwyk6#
如果您的React本地版本低于0.63或0.64.X,请尝试以下步骤
在***android/app/build.gradle中***添加以下行
并在*android/build.gradle中*通过在resolutionStrategy中更改您当前的本机版本来添加这些行
然后cd android ./gradlew清理并运行npx react-native run-android
k3bvogb17#
将其添加到android/buld.gradle文件的allprojects区域。