Getting error when run react-native run-android
Asked Answered
V

5

31
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:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom
             file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
             file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
           Required by:
             beostore:react-native-fbsdk:unspecified
         > Could not find com.android.support:appcompat-v7:27.0.1.
           Searched in the following locations:
             file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom
             file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
             file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
           Required by:
             beostore:react-native-fbsdk:unspecified > com.facebook.react:react-native:0.46.4
         > Could not find com.android.support:support-annotations:27.0.1.
           Searched in the following locations:
             file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.pom
             file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar
             file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/support-annotations/27.0.1/support-annotations-27.0.1.jar
           Required by:
             beostore: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:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.pom
             file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.jar
             file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/support-core-utils/27.0.1/support-core-utils-27.0.1.jar
           Required by:
             beostore: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:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.pom
             file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
             file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/appcompat-v7/27.0.1/appcompat-v7-27.0.1.jar
           Required by:
             beostore: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:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.pom
             file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar
             file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/cardview-v7/27.0.1/cardview-v7-27.0.1.jar
           Required by:
             beostore: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:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/customtabs/27.0.1/customtabs-27.0.1.pom
             file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/customtabs/27.0.1/customtabs-27.0.1.jar
             file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/customtabs/27.0.1/customtabs-27.0.1.jar
           Required by:
             beostore: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:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.pom
             file:/home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar
             file:/home/ubuntu/git/mstore-pro/android/sdk-manager/com/android/support/support-v4/27.0.1/support-v4-27.0.1.jar
           Required by:
             beostore:react-native-fbsdk:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0

compileSdkVersion 25

buildToolsVersion "25.0.0"

targetSdkVersion 25

Vingtetun answered 6/12, 2017 at 9:46 Comment(0)
C
13

I've faced the same issue today.

Looks like there is some problem with react-native-fbsdk package;

I've found the only way to solve it for now:

at node_modules/react-native-fbsdk/android/build.gradle

change compile('com.facebook.android:facebook-android-sdk:4+')

to compile('com.facebook.android:facebook-android-sdk:4.26.0')

This is very bad solution.

If you will find proper way to solve it - please share.

Chicalote answered 6/12, 2017 at 13:38 Comment(2)
It worked for me, but I've changed to version 4.28.0. A good practice is always specif the library version instead of using the plus character.Schou
Thanks to you I solved a one-week-end problem that was related to this issue. Thank you very much.Parasympathetic
H
34

The accepted answer does the trick but a cleaner solution would be to restrict the android fbsdk version used in the react native fbsdk library. Adding the below code to project(root) build.gradle made sure that the specified version of fbsdk is used by all library projects.

allprojects {
    repositories {
        ...
        configurations.all {
            resolutionStrategy {
                force 'com.facebook.android:facebook-android-sdk:4.28.0'
            }
        }
    }
}
Hindbrain answered 7/12, 2017 at 10:3 Comment(2)
Ah this works! In my first attempt, I placed it in the wrong build.gradle file. But once i placed it in the root build.gradle it worked.Undergraduate
Be sure you have the latest build gradle com.android.tools.build:gradle:3.0.1 otherwise it still might not work!Longsuffering
C
13

I've faced the same issue today.

Looks like there is some problem with react-native-fbsdk package;

I've found the only way to solve it for now:

at node_modules/react-native-fbsdk/android/build.gradle

change compile('com.facebook.android:facebook-android-sdk:4+')

to compile('com.facebook.android:facebook-android-sdk:4.26.0')

This is very bad solution.

If you will find proper way to solve it - please share.

Chicalote answered 6/12, 2017 at 13:38 Comment(2)
It worked for me, but I've changed to version 4.28.0. A good practice is always specif the library version instead of using the plus character.Schou
Thanks to you I solved a one-week-end problem that was related to this issue. Thank you very much.Parasympathetic
L
7

I have the same issue since this morning and as far as I can see it is a problem with the react-native-fbsdk library and android support repository.

If you go into any of the subfolders on the path where your sdk is installed (in your case) "home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support" you will probably see the "26.0.0-alpha1" as the last folder even though google (https://dl.google.com/dl/android/maven2/index.html - collapse com.android.support) clearly suggests the last folder should be "27.0.2"!

I have tried downloading the latest android_m2repository from the acquired link: https://dl.google.com/android/repository/android_m2repository_r47.zip but it is also missing all the following folders: 26.0.0-beta1, 26.0.0-beta2, 26.0.0, 26.0.1, 26.0.2, 26.1.0, 27.0.0, 27.0.1, 27.0.2

I managed to remove the error by editing node_modules/react-native-fbsdk/android/build.gradle

compile('com.facebook.android:facebook-android-sdk:4.28.0')

but am still not able to build and I am sure this is not the propper way to go even if you are able to build!

Longsuffering answered 6/12, 2017 at 12:30 Comment(0)
T
5

Follow these Steps and Make your Build Successful

  1. Go to Project build.gradle file adding maven {url"https://maven.google.com"} Will download the missing items .

  2. android/build.gradle file and restrict fbsdk Version to 4.28.0.

OTHER WAY

Go to node_modules/react-native-fbsdk : build.gradle change to compileSdkVersion 26 or 27

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"
            }

        }
    }  
Thermosetting answered 7/12, 2017 at 7:34 Comment(0)
C
0

Updating Android studio solved this for me...

Below are the steps I followed

  • Updated android-sdk(downloaded platform and build tools for version 27 and other auto suggests)
  • Updated Android Studio
  • Synced the dependency projects
  • Android Studio automatically asked for updating gradle
  • Running react-native run-android auto downloaded dependencies from gradle-4.1-all.zip which was auto added into my "gradle-wrapper.properties" file because of gradle update from the above step
Corri answered 6/12, 2017 at 14:29 Comment(2)
updating android studio is not creting /home/ubuntu/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.0.1/ folder for meVingtetun
@Anantkamat Updated my exact steps. Hope that helps... BTW the appcompat-v7/27.0.1 folder is not added into my sdk as well... But I do not get the error anymore...Corri

© 2022 - 2024 — McMap. All rights reserved.