question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-native-fbsdk makes my build fail

See original GitHub issue

Is this a bug report?

YES

Have you read the Contributing Guidelines?

YES

Environment

OS:  macOS Sierra 10.12.6
Node:  8.9.3
Yarn:  1.3.2
npm:  5.6.0
Watchman:  4.9.0
Xcode: 9.1 (9B55)
Android Studio:  3.0 AI-171.4443003

Packages: (wanted => installed) “react”: “^16.0.0-beta.5” “react-native”: “^0.49.5”

Steps to Reproduce

  1. create-react-native-app my-test-app
  2. cd my-test-app
  3. npm run eject 3.1. option1: React Native: I’d like a regular React Native project 3.2 option2: give a name 3.3 option3: confirm
  4. yarn add react-native-fbsdk
  5. react-native link react-native-fbsdk
  6. configure native project as described here
  7. react-native run-android

Expected Behavior

The app is built and runs on android without any problem

Actual Behavior

I have this error during the build of the project:

➜  my-test-app react-native run-android
Scanning folders for symlinks in /Users/sunrising/Documents/work/sitrap/my-test-app/node_modules (7ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':react-native-fbsdk'.
      > Could not resolve all dependencies for configuration ':react-native-fbsdk:_debugPublishCopy'.
         > Could not find com.android.support:appcompat-v7:27.0.1.
           Searched in the following locations:
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
               file:/Users/sunrising/Documents/work/sitrap/my-test-app/android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
           Required by:
               mytestapp:react-native-fbsdk:unspecified
         > Could not find com.android.support:appcompat-v7:27.0.1.
           Searched in the following locations:
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
               file:/Users/sunrising/Documents/work/sitrap/my-test-app/android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
           Required by:
               mytestapp:react-native-fbsdk:unspecified > com.facebook.react:react-native:0.50.3
         > Could not find com.android.support:support-annotations:27.0.1.
           Searched in the following locations:
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.pom
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar
               file:/Users/sunrising/Documents/work/sitrap/my-test-app/android/sdk-manager/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar
           Required by:
               mytestapp:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-core:4.29.0
         > Could not find com.android.support:support-core-utils:27.0.1.
           Searched in the following locations:
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.pom
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.jar
               file:/Users/sunrising/Documents/work/sitrap/my-test-app/android/sdk-manager/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.jar
           Required by:
               mytestapp:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-core:4.29.0
         > Could not find com.android.support:appcompat-v7:27.0.1.
           Searched in the following locations:
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
               file:/Users/sunrising/Documents/work/sitrap/my-test-app/android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
           Required by:
               mytestapp:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0
         > Could not find com.android.support:cardview-v7:27.0.1.
           Searched in the following locations:
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.pom
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar
               file:/Users/sunrising/Documents/work/sitrap/my-test-app/android/sdk-manager/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar
           Required by:
               mytestapp:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0
         > Could not find com.android.support:customtabs:27.0.1.
           Searched in the following locations:
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/customtabs/27.0.1/customtabs-27.0.1.pom
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/customtabs/27.0.1/customtabs-27.0.1.jar
               file:/Users/sunrising/Documents/work/sitrap/my-test-app/android/sdk-manager/com/android/support/customtabs/27.0.1/customtabs-27.0.1.jar
           Required by:
               mytestapp:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0
         > Could not find com.android.support:support-v4:27.0.1.
           Searched in the following locations:
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.pom
               file:/Users/sunrising/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar
               file:/Users/sunrising/Documents/work/sitrap/my-test-app/android/sdk-manager/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar
           Required by:
               mytestapp:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0

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

BUILD FAILED

Total time: 11.653 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

Reproducible Demo

Take a look at Steps to Reproduce

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:43
  • Comments:27 (3 by maintainers)

github_iconTop GitHub Comments

40reactions
crysfelcommented, Dec 15, 2017

I had to define the facebook sdk version on android/build.gradle:

allprojects {
    repositories {
        ...
        configurations.all {
            resolutionStrategy {
                force 'com.facebook.android:facebook-android-sdk:4.28.0'
            }
        }
    }
}
17reactions
warrenronsiekcommented, Jan 22, 2018

Adding a maven repository url to google solved this for me:

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            url "https://maven.google.com"
            }
        configurations.all {
            resolutionStrategy {
                force 'com.facebook.android:facebook-android-sdk:4.28.0'
                }
            }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
                url "$rootDir/../node_modules/react-native/android"
            }

        }
    }  
Read more comments on GitHub >

github_iconTop Results From Across the Web

React native build fail react-native-fbsdk - Stack Overflow
the commands are first try npm i jetifier and then npx jetify to solve your problem. Hope it helps, feel free for doubts....
Read more >
failed to build project, possibly related to react-native-fbsdk ...
Hi everybody, 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.
Read more >
react-native-fbsdk-next - npm
I get this build error: no type or protocol named UIApplicationOpenURLOptionsKey : Your Xcode version is too old. Upgrade to Xcode 10.0+. You ......
Read more >
React-native – Facebook Sdk Android Error Building - iTecNote
I am trying to build my react-native project and using react-native fbsdk. However, I get these errors:
Read more >
gradle build failed after installing react-native-fbsdk with error ...
Coding example for the question gradle build failed after installing react-native-fbsdk with error of Error retrieving parent for item: No resource found ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found