React Native 突然抛出 2022 年 5 月 9 日

React Native suddenly throwing May 09 2022

我目前正在开发一个 React Native 项目,该项目以前由其他开发人员开发过。它在 2022 年 5 月 9 日之前编译得很好,然后我现在尝试编译它,但它现在抛出

BUILD FAILED in 41s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:checkDebugAarMetadata'.
    > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
       > Could not resolve com.facebook.android:facebook-android-sdk:9.0.+.
         Required by:
             project :app > project :react-native-fbsdk-next
          > Failed to list versions for com.facebook.android:facebook-android-sdk.
             > Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
                > Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.
                   > org.apache.http.client.ClientProtocolException (no error message)

没有添加新的包,我什至试图恢复到旧的提交来确认它是否与包相关,但它仍然抛出这个错误。 Maven 最近是否有任何更改或更新?我还有其他开发人员在 Mac 上,他们的开发人员似乎编译得很好

我不是 React Native 的专家,我才开始使用它,从 2022 年 5 月 9 日开始我也遇到了同样的问题。但我能够修复它。

您可以按照以下步骤操作,也许它也适合您。

打开此文件 node_modules/react-native-fbsdk-next/android/build.gradle 并将第 48 行更改为以下行

def FACEBOOK_SDK_VERSION = safeExtGet('facebookSdkVersion', '9.0.0')