gabogabans
gabogabans

Reputation: 3551

React Native: failed to build project, possibly related to react-native-fbsdk-next?

in my react-native app I am SUDDENLY getting this build error!

It seems to be related to react-native-fbsdk-next I'm using...

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies 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)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 54s

    at makeError (C:\xampp\htdocs\AdoptaTias\node_modules\execa\index.js:174:9)
    at C:\xampp\htdocs\AdoptaTias\node_modules\execa\index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async runOnAllDevices (C:\xampp\htdocs\AdoptaTias\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
    at async Command.handleAction (C:\xampp\htdocs\AdoptaTias\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.

This is my android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    ext {

        buildToolsVersion = "30.0.3"
        minSdkVersion = 26
        compileSdkVersion = 30
        targetSdkVersion = 30

        

        googlePlayServicesAuthVersion = "18.0.0" // <--- use this version or newer
        /*androidXAnnotation = "1.2.0"
        androidXBrowser = "1.3.0"*/
    }
    repositories {

        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven { 
            // react-native-date-picker
            url "https://www.jitpack.io" 
        }

        google()
        mavenCentral()
        maven { url "https://maven.google.com" }

        maven { url "https://plugins.gradle.org/m2/" }
        maven { url "https://repo.spring.io/plugins-release/" }
    }
    dependencies {
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        //classpath("com.android.tools.build:gradle:3.5.3")
        classpath("com.android.tools.build:gradle:4.0.0")
        //Added this line
        classpath('com.google.gms:google-services:4.3.4')

        

        
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven { 
            // react-native-date-picker
            url "https://www.jitpack.io" 
        }

        google()
        mavenCentral()
        maven { url "https://maven.google.com" }

        maven { url "https://plugins.gradle.org/m2/" }
        maven { url "https://repo.spring.io/plugins-release/" }
    }
}

Upvotes: 3

Views: 890

Answers (3)

h4mxa
h4mxa

Reputation: 1

I was getting the same error from same package yesterday, Just change your network or use VPN

Upvotes: 0

Akshita Yadav
Akshita Yadav

Reputation: 1

go to android\build.gradle go to allProjects->repostories-> just add mavenCentral() then build the app

Upvotes: 0

Tanzimul haque niloy
Tanzimul haque niloy

Reputation: 21

  • go to android\build.gradle
  • find all the jcenter()
  • replace them with gradlePluginPortal() / or just trying adding this gradlePluginPortal() both in repositories and all porjects
  • try to build the app now

Upvotes: 2

Related Questions