0

I follow this guide to use react-native-fbsdk in my freshly created app, but whit react-native run-android command, I get this ..

FAILURE: Build failed with an exception.

What went wrong: A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugApkCopy'. Could not find com.android.support:appcompat-v7:27.0.2.

react-native version 0.55.1

Any suggestions?

Satendra
  • 6,755
  • 4
  • 26
  • 46
Vissarionas
  • 21
  • 1
  • 4
  • Follow link for [Reference for react-native-fbsdk](https://stackoverflow.com/questions/47757074/react-native-fbsdk-error-no-resource-found-that-matches-the-given-name-attr-a) – Syed Zain Ali Apr 09 '18 at 09:10

2 Answers2

0

Got it working finally.

1) added maven in android level build.gradle

allprojects {
    repositories {
        ...
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

2) Changed the compileSdkVersion in the app level build.gradle file, to be the same as the compileSdkVersion in the react-native-fbsdk build.gradle file.

Vissarionas
  • 21
  • 1
  • 4
0

In case anyone is still looking for this, here's what I did based on the answers from Vissarionas and Sachin for this question and similar ones.

Make sure you are using the compatible version of gradle

Update android/gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

Update android/build.gradle classpath

classpath 'com.android.tools.build:gradle:3.1.2'

Add maven google url

Update android/build.gradle (both buildscript and allprojects)

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    ...
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

Check that you are using at least API 26

If you are using an older react native version prior to the changes where they updated to use API 26, check these values in your android/app/build.gradle file:

compileSdkVersion 26
buildToolsVersion "26.0.3"

defaultConfig {
    ...
    targetSdkVersion 26
    ...
}
Bruno Campos
  • 2,188
  • 1
  • 20
  • 34