由于這個錯誤,我的反應原生專案構建以某種方式失敗:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
> 2 files found with path 'lib/arm64-v8a/libfbjni.so' from inputs:
- C:\Users\Antonio\.gradle\caches\transforms-3\7cca348744e25f57fc2d9f871aa73c9a\transformed\jetified-react-native-0.71.0-rc.0-debug\jni\arm64-v8a\libfbjni.so
- C:\Users\Antonio\.gradle\caches\transforms-3\08b0f5c7017bf081f79b63ea5b053dc0\transformed\jetified-fbjni-0.3.0\jni\arm64-v8a\libfbjni.so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
有人知道什么可能導致構建失敗嗎?我沒有編輯任何構建檔案和/或洗掉/安裝/升級新包謝謝
uj5u.com熱心網友回復:
對我來說這很有效(在閱讀了托尼的鏈接之后),我的反應版本是 0.66.0
更改了這個檔案 android\app\build.gradle
implementation "com.facebook.react:react-native: " // From node_modules
至
implementation "com.facebook.react:react-native:0.66.0!!" // From node_modules
uj5u.com熱心網友回復:
為我作業,如果您對本機應用程式版本 >= 0.63 做出反應,您可以更新應該解決您的問題的補丁版本。
鏈接:https ://github.com/facebook/react-native/issues/35210#:~:text=We have prepared releases for all the main versions of react-native with an hotfix:
如果不只是去android/build.gradle然后在 allprojects 物件中添加以下代碼,并在 package.json 中使用當前版本的 react native
configurations.all {
resolutionStrategy {
force 'com.facebook.react:react-native:CURRENT_VERSION_OF_REACT_NATIVE'
}
}
uj5u.com熱心網友回復:
如果您不使用最新版本的 react-native,這里有一個解決此問題的解決方法。 https://github.com/facebook/react-native/issues/35210
uj5u.com熱心網友回復:
這里同樣的問題。它發生在 12 小時前,基本上在那之前我沒有更改任何代碼。
任務 ':app:mergeDebugNativeLibs' 執行失敗。
執行 com.android.build.gradle.internal.tasks.MergeJavaResWorkAction 2 檔案時發生故障,從輸入中找到路徑“lib/armeabi-v7a/libfbjni.so”:-/Users/erdalkilic/.gradle/caches/transforms- 3/9774db1afd8a27209dd17f0d0ee82cc8/transformed/jetified-react-native-0.71.0-rc.0-debug/jni - /Users/erdalkilic/.gradle/caches/transforms-3/587226f58025f84b74ebb542f6c09f7b/transformed/jetified-fbjni- jni 如果您使用 jniLibs 和 CMake IMPORTED 目標,請參閱 https://developer.android.com/r/tools/jniLibs-vs-imported-targets
uj5u.com熱心網友回復:
簡短的回答:
在你的 android/app/build.gradle
改變
implementation 'com.facebook.react:react-native: '
到 ---> (將 0.67.2 替換為您當前的 react 本機版本)
implementation 'com.facebook.react:react-native:0.67.2!!'
長答案:
發生這種情況是因為所有模板都按范圍參考 React Native 依賴項,例如implementation 'com.facebook.react:react-native: '. 通常,這種依賴關系是從 ./node_modules/react-native/android 中的本地 Maven 存盤庫解決的,但由于它已發布到 Maven Central,它現在正在獲取最新的 RC。
您可以通過implementation 'com.facebook.react:react-native:0.67.2!!'在應用程式的 Gradle 檔案中將 React Native 依賴項強制為您期望的版本來解決此問題。!!如果您的專案或其傳遞依賴項依賴于較新版本,則這是限制 Gradle 升級的簡寫。
uj5u.com熱心網友回復:
我遇到過同樣的問題。現在有一個 react-native 的新補丁,所以在你的 package.json 中更新它。
我的是
"react-native": "^0.70.3"
我把它改成了
"react-native": "^0.70.5"
這對我有用
uj5u.com熱心網友回復:
轉到android 檔案夾 -> build.gradle 檔案 -> 在 allprojects 物件內并添加以下代碼。從node_modules -> react-native -> package.json添加 react native 版本// "version": "0.68.2"。
configurations.all {
resolutionStrategy {
force 'com.facebook.react:react-native:0.68.2'
}
}
見fb/rn#35204
uj5u.com熱心網友回復:
答案就在這里,具體取決于您的本機反應版本。補丁適用于 RN 0.63 及更高版本
https://github.com/facebook/react-native/issues/35210
提示:
- 不要只更新 react-native 包,做一個 npm install
- 在運行應用程式之前清理 gradle
- 僅當您的反應本機版本 < 0.63 時才添加下面的代碼
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
configurations.all {
resolutionStrategy {
// Remove this override in 0.65 , as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" REACT_NATIVE_VERSION
}
}
}
uj5u.com熱心網友回復:
這是官方推薦的修復!
通過這個問題找到:https ://github.com/facebook/react-native/issues/35210 。
從這個 PR 復制到這里
對于我的 RN 0.66.0 專案,我只需要添加這些行:
allprojects {
repositories {
exclusiveContent {
// Official recommended fix for Android build problem with React Native versions below 0.71
// https://github.com/facebook/react-native/issues/35210
// TODO: remove this exclusiveContent section when we upgrade to React Native 0.71 (or above)
// copied from https://github.com/Scottish-Tech-Army/Volunteer-app/pull/101/commits/40a30310ee46194efbaf1c07aef8a0df70231eeb
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/530128.html
標籤:反应式毕业典礼android-gradle-插件构建.gradle机器人喷射器
上一篇:嘗試獲取構建腳本讀取java檔案時出錯-無法決議配置“:classpath”的所有工件
下一篇:MVC表單資料無法系結到模型
