Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native-fbsdk makes my build fail #17147

Closed
AlessandroAnnini opened this issue Dec 11, 2017 · 27 comments
Closed

react-native-fbsdk makes my build fail #17147

AlessandroAnnini opened this issue Dec 11, 2017 · 27 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. Resolution: Locked This issue was locked by the bot.

Comments

@AlessandroAnnini
Copy link

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

@patrikmasiar
Copy link

I have the same issue.

@AlessandroAnnini
Copy link
Author

AlessandroAnnini commented Dec 11, 2017

now i have in my android/app/build.gradle

...

compileSdkVersion 26
    buildToolsVersion "26.0.1"

    defaultConfig {
        applicationId "..."
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }

...

dependencies {
    compile project(':react-native-fbsdk')
    compile project(':react-native-vector-icons')
    compile project(':react-native-splash-screen')
    compile project(':react-native-spinkit')
    compile project(':react-native-orientation')
    compile project(':react-native-maps')
    compile project(':react-native-android-sms-listener')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:26+"
    compile "com.android.support:design:26+"
    compile "com.android.support:recyclerview-v7:26+"
    compile "com.android.support:cardview-v7:26+"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile("com.crashlytics.sdk.android:crashlytics:2.8.0@aar") {
        transitive = true;
    }
}

but i always get

<mypath> .../node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15:21-54: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

<mypath> .../node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.


:react-native-fbsdk:processReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-fbsdk:processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

@chirag04
Copy link
Contributor

chirag04 commented Dec 11, 2017

This might be a problem in react-native-fbsdk or your app setup. I suggest asking this on the react-native-fbsdk or stackoverflow.

android:keyboardNavigationCluster seems like you are missing some configuration in your manifest or some strings xml.

@chirag04
Copy link
Contributor

@facebook-github-bot stack-overflow

@AlessandroAnnini
Copy link
Author

@chirag04 it seems that react-native-fbsdk has the issue section disabled, I will try in stackoverflow anyway... have you ever seen something like this?

@AlessandroAnnini
Copy link
Author

AlessandroAnnini commented Dec 11, 2017

on stackoverflow:
react-native-fbsdk error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'

@facebook-github-bot
Copy link
Contributor

Hey @sun2rise, thanks for posting this! @chirag04 tells me this issue looks like a question that would be best asked on Stack Overflow. Stack Overflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

How to ContributeWhat to Expect from Maintainers

@facebook-github-bot facebook-github-bot added the Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. label Dec 11, 2017
@facebook-github-bot facebook-github-bot added the Ran Commands One of our bots successfully processed a command. label Dec 11, 2017
@yannickschuchmann
Copy link

For me this was the simplest solution.
Way better than fiddling with node_modules. But be aware of updating the SDK dependency manually from time to time.. :)

@crysfel
Copy link

crysfel commented 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'
            }
        }
    }
}

@rafaesc
Copy link

rafaesc commented Dec 15, 2017

I tried it @yannickschuchmann @crysfel

But returns to me another error:
Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'

It works to me, with

configurations.all {
            resolutionStrategy {
                force 'com.facebook.android:facebook-android-sdk:4.22.1'
            }
        }

Thanks!

@ujwal-setlur
Copy link

@rafaesc You might be using a lower compileSdkVersion and buildToolsVersion under android/app/build.gradle. I had used 23 and 23.0.1 respectively, and had the same problem as you. When I used 26 and 26.0.1, I could use the solution by @yannickschuchmann

    compileSdkVersion 26
    buildToolsVersion "26.0.1"

@nenti
Copy link

nenti commented Jan 13, 2018

Error reappeared in [email protected] and the resolutionStrategy with fiex facebook-sdk version doesn't help in 0.7.0. Anyone has a solution for the new version?

@rafaesc
Copy link

rafaesc commented Jan 13, 2018

@nenti, yes, I had to change to 0.6.3 version, I need a new solution for 0.7.0
@ujwal-setlur, I didn't want to change the compileSdkVersion, because I wanted to maintain the default settings of react-native, but that solution would work.

@ujwal-setlur
Copy link

0.70.0 works for as long as I stick to older sdk libraries. When I use latest sdk library, app crashes on launching.

@MinhNQ90
Copy link

MinhNQ90 commented Jan 15, 2018

I try all the solution which have been provided but it didn't work.
My issue is in fbsdk build.gradles, it use com.android.support:appcompat-v7:27.0.2
but the newest version i can see in my folder C:\Users\ComputerName\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\appcompat-v7 is 26.0.0-alpha1
I try to update in Android Studio but still the same.

@warrenronsiek
Copy link

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

        }
    }  

@heralight
Copy link

for react-native-fbsdk 0.7.0, as explain #17147 (comment) @rafaesc, you need to upgrade your settings:
compileSdkVersion 27
buildToolsVersion "27.0.1"

and there is an error in facebook docs:
use
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
instead of
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'

@chuckcwh
Copy link

chuckcwh commented Mar 12, 2018

@heralight
As you mentioned the error in facebook docs

use
compile 'com.facebook.android:facebook-android-sdk:[4,5)'

<-- this is the same as facebook doc right?

I just tested in a new blank app with:
RN 0.54.1
react-native-fbsdk 0.7.0

My app BUILD SUCCESSFUL but app crashed.

@donghungx
Copy link

what a idiot SDK, cant get success build

@ujwal-setlur
Copy link

Yeah, given that this is a Facebook module meant to work with their own react-native framework, I must say this should have been much more robust

@heralight
Copy link

@chuckcwh there is an error in https://developers.facebook.com/docs/android/getting-started/
they write "implementation" in step 5 instead of "compile"...

Have you any log on crash, rn or android ?

@chuckcwh
Copy link

chuckcwh commented Mar 14, 2018

@heralight
Thanks for reply.
I was following this: so I used "compile".

Finally I got it to work!

What I did
blank app with only
react-native 0.54.2 (I tried from 0.52, 54.0, 54.1, 54.2)
react-native-fbsdk 0.7.0

after following the tutorial the errors were

Could not find com.android.support:appcompat-v7:27.0.2.
...

then I added this to build.gradle

allprojects {
repositories {
...
maven {
url "https://maven.google.com"
}
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.28.0'
}
}
}
}

the error became this:

/Users/chuck/Code/fblogin/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
...

then in app/build.gradle I changed to
compileSdkVersion 26
buildToolsVersion "26.0.1"

defaultConfig {
...
targetSdkVersion 26
}

And then It works on android now :)
Guys please give it a try

@heralight
Copy link

@chuckcwh if you upgrade compileSdkVersion and buildToolsVersion, you don't need to
force 'com.facebook.android:facebook-android-sdk:4.28.0' ...

@grocco
Copy link

grocco commented Mar 14, 2018

Just changing compileSdkVersion, buildToolsVersion and targetSdkVersion to 26, "26.0.1" and 26 respectively in app/build.gradle solved it for me. Thanks @heralight and @chuckcwh !

xavi pushed a commit to xavi/react-native-fbsdk that referenced this issue Apr 5, 2018
@sfratini
Copy link

sfratini commented Apr 9, 2018

Just a comment. Using API 26 is breaking the Dev Menu in Android 8, because of a change in permissions with the overlay. Just blindily putting a greater compileVersion is not that good idea.

#4043

@SalviShahzad
Copy link

I followed all the steps by @chuckcwh but still my app is crashing in debug

@peferb
Copy link

peferb commented May 16, 2018

So to get FB-login working in react-native you have to up target and compile sdk to 26? Which isnt supported by react native?

Or, not to risk breaking anything, I have to use a old version of fbsdk targeting sdk 23?

@facebook facebook locked as resolved and limited conversation to collaborators Dec 11, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Dec 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests