Home » Android » react-native-fb sdk com.android.support dependency error

react-native-fb sdk com.android.support dependency error

Posted by: admin June 15, 2020 Leave a comment

 > 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:
       Required by:

This issue started happening this morning when running react-native run-android without making any changes to the code or adding new packages, it was working fine untill now!

“react-native”:”0.50.3″, “react-native-fbsdk”:”0.6.3″

I can see that I am missing android support libraries in my sdk/extras/android/m2repository/com/android/support subfolders, all the subfolders have the 26.0.0-alpha1 folder as the last one.
I already tried removing support repository and installing again through android studio and downloading the latest android_m2repository manually but the folders are still missing.

What I am having trouble understanding is why google's maven repository (https://dl.google.com/dl/android/maven2/index.html) states that under for example m2repository/com/android/support/appcompat-v7 I should have a folder named 27.0.2 (along with some previous versions which are also missing) but even in the latest android_m2repository which they offer it is also missing!


How to&Answers:

I also have the same issue. I was able to successfully build by updating my
ROOT : android/build.gradle file.

1. All you have to do is add a new maven line to the allprojects section for maven.google.com
2. Add resolutionStrategy Will Restrict your android fbsdk version to 4.28.0

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


I see that another thread was open on this very same issue: getting error when run react-native run-android

The solution recommended there is close to Sutani one, that is editing node_modules/react-native-fbsdk/android/build.gradle
and adding


It seems not to be a regression introduced by react-native-fbsdk but by Google Android libraries but I am not 100% clear about it.


i have same problem, and i solved with :

  1. edit package.json and i am edit react-native-fbsdk from react-native-fbsdk": "0.6.3" to react-native-fbsdk": "0.6.0"

  2. go to your node_modules/react-native-fbsdk/android/build.gradle. open build.gradle file.

  3. Change compile('com.facebook.android:facebook-android-sdk:4++') to compile('com.facebook.android:facebook-android-sdk:4.22.1'),

but I don’t know if this is the best way for this problem,
thank you



sed -i -e 's/com.facebook.android:facebook-android-sdk:4.+/com.facebook.android:facebook-android-sdk:4.26.0/' $culpritLocation

printf "Fixed Could not resolve all dependencies for configuration ':react-native-fbsdk:_debugPublishCopy'.\n> Could not find com.android.support:appcompat-v7:27.0.1."
printf "fix_rn_fbsdk_google_libraries.sh should be removed at a later time\n"

Place the above script in the root of your react-native project, add executing permissions to it, then in package.json within the postinstall property add ./your-script-name.sh;. Ex:

  "name": "AppName",
  "version": "1.28.14",
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "postinstall": "./fix_rn_fbsdk_google_libraries.sh; ./infuse_version.sh;"

If you’re not familiar with postinstall scripts, they’ll run immediately after running npm install / yarn command.

The proposed solution works with cloud build tools 🙂 and it is only temporary. Future rn-fbsdk releases should fix the issue.


The key is in the error message shown in your case:

Searched in the following locations:

I have had the same. Then I went to the location:


And found that there is no directory named 27.0.1 because in my case the latest buildTool was not downloaded. In my case I have had 27.0.0-alpha1.

So in both of my app build.gradle and in


I replaced 27.0.1 with 27.0.0-alpha1 and build was successful.


build.gradle — app

dependencies {
    compile 'com.facebook.react:react-native:+' // support react-native-v0.22-rc+

    allprojects {
        repositories {
            configurations.all {
                resolutionStrategy {
                    force 'com.facebook.android:facebook-android-sdk:4.28.0'


How to fix the file permissions, after loading end react-native start

First, Go to android folder

cd android

Now clean the project...

gradlew clean //for Mac users, change gradlew to ./gradlew

Now run the build process again in the root folder 
cd ..
react-native run-android

Solved Issue Happy Coding!