0

I am currently working on a React Native project that has been previously worked on by other devs. it was compiling fine as before May 09 2022 then I tried to compile it now and it's now throwing

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)

No new packages were added, I even tried to revert to old commits just to confirm if it's package related and it still threw this error. Was there any changes or update with Maven recently? I have other devs that are on Mac and theirs seem to be compiling just fine

Jam
  • 117
  • 11
  • may be this answer could help you https://stackoverflow.com/a/46484474/16408818 – DiveDive May 10 '22 at 09:39
  • @DiveDive I followed it but it's weird because it only has com.facebook.react:react-native in the dependencies I can't seem to be able to find com.facebook.android:facebook-android-sdk. – Jam May 11 '22 at 11:28

1 Answers1

1

I am not an expert in react native, I only started using it and I also have the same issue from 9th may 2022. But I am able to fixed it.

You can follow the below steps and may be it will work for you too.

Open this file node_modules/react-native-fbsdk-next/android/build.gradle and change Line no 48 with below line

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

Mono
  • 26
  • 2
  • thanks a lot! I've now resolved the facebook error, will be looking solutions for the other errors – Jam May 12 '22 at 03:34
  • I managed to resolve the other errors by adding mavenCentral in allprojects under android build.gradle followed this solution: https://stackoverflow.com/a/30800935/12539780 again, thanks a lot! – Jam May 12 '22 at 03:43