Search code examples
facebookreact-nativefbsdkreact-native-fbsdk

Facebook Sdk Android Error Building


I am trying to build my react-native project and using react-native fbsdk.

However, I get these errors:

/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/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'.

/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.


:react-native-fbsdk:processReleaseResources FAILED

My current OS is Linux Elementary 0.4.1 Loki x64.

I am using [email protected] and, because of this, [email protected].

I've already tried:

  • cd android && ./gradlew clean

  • delete the project and re npm install it

  • and try in Android API's 23 and 24.


Solution

  • After digging into gradle, I came up with following solution.

    Key is to exclude facebook-android-sdk required by react-native-fbsdk and pull in desired (working) version on facebook-android-sdk module - preferably without modifying anything in node_modules folder.

    Fortunately, gradle offers this.

    // android/app/build.gradle
    
    dependencies {
        compile(project(':react-native-fbsdk')){
          exclude(group: 'com.facebook.android', module: 'facebook-android-sdk')
        }
        compile "com.facebook.android:facebook-android-sdk:4.22.1"
    }