Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'
Asked Answered
J

6

14

Today, I face the error mentioned in this post: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'

The funny thing (and the difference) is - our application is 5 months in production and we've made hundreds of builds and APKs so far. We didn't change a single line of code for a week (neither any of library version) and the build has suddenly stopped working with this mentioned error.

Execution failed for task ':react-native-fbsdk:processReleaseResources'

X:\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'.
X:\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'.    
X:\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'.    
X:\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'.

Using these versions of libraries (package.json):

...
"react": "15.3.2",
"react-native": "0.37.0",
...
"react-native-fbsdk": "~0.5.0",
...

Our build.gradle (not whole), which worked until now:

    compileSdkVersion 24
    buildToolsVersion '24.0.3'
    defaultConfig {
        applicationId "xxx"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 14
        versionName "1.5.3"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }

dependencies {
    compile project(':react-native-device-info')
    compile project(':react-native-maps')
    compile project(':realm')
    compile project(':react-native-vector-icons')
    compile project(':react-native-image-picker')
    compile project(':react-native-fs')
    compile project(':react-native-share')
    compile project(':react-native-push-notification')
    compile project(':react-native-fbsdk')
    compile('com.google.android.gms:play-services-gcm:9.4.0') {
        force = true;
    }
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.facebook.react:react-native:+'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.3'
    compile 'com.fasterxml.jackson.core:jackson-core:2.2.3'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
}

Any ideas please?

Jens answered 26/5, 2017 at 12:49 Comment(2)
Yesterday my code was working well, today when I tested, I got the same error. Maybe there was some update in the background that broke this.Bayer
check this answer: #42144915Georgiannegeorgic
J
7

Finally I've found a solution. After reading all answers and related issues (Facebook Sdk Android Error Building) and trying many things (libs updating, dependencies, lots of version changes etc.) I managed to build my app again. Then I reverted all unnecessary changes and there's what was left:

I needed to add 2 things (iterator and line with "force") in my android/build.gradle file (not android/app/build.gradle):

allprojects {
    configurations.all {
       resolutionStrategy {
         eachDependency { DependencyResolveDetails details ->
           if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
             details.useVersion "0.37.0" // Your real React Native version here
           }
         }
         force 'com.facebook.android:facebook-android-sdk:4.22.1'
       }
    }
}

Thanks for all the tips anyway!

Jens answered 29/5, 2017 at 12:13 Comment(2)
My team has just found a thing that I didn't realize - this solution is "android only" and our app still can't be built for iOS :(Jens
I was having the same problem and your solution worked for me with react-native v0.41.2 and react-native-fbsdk v0.5.0. Cheers!Tegument
B
14

I think this is the same problem as Facebook Sdk Android Error Building

You have to change from

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

to

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

in node_modules\react-native-fbsdk\android\build.gradle

Bayer answered 26/5, 2017 at 21:28 Comment(2)
Thanks for the tip, but this fix was related to another bug with fbsdk update (github.com/facebook/react-native/issues/14225). So it didn't help me :(Jens
It's the other way around, from 4+ to 4.22.1Briarroot
J
7

Finally I've found a solution. After reading all answers and related issues (Facebook Sdk Android Error Building) and trying many things (libs updating, dependencies, lots of version changes etc.) I managed to build my app again. Then I reverted all unnecessary changes and there's what was left:

I needed to add 2 things (iterator and line with "force") in my android/build.gradle file (not android/app/build.gradle):

allprojects {
    configurations.all {
       resolutionStrategy {
         eachDependency { DependencyResolveDetails details ->
           if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
             details.useVersion "0.37.0" // Your real React Native version here
           }
         }
         force 'com.facebook.android:facebook-android-sdk:4.22.1'
       }
    }
}

Thanks for all the tips anyway!

Jens answered 29/5, 2017 at 12:13 Comment(2)
My team has just found a thing that I didn't realize - this solution is "android only" and our app still can't be built for iOS :(Jens
I was having the same problem and your solution worked for me with react-native v0.41.2 and react-native-fbsdk v0.5.0. Cheers!Tegument
E
3

actually there is some dependencies problem i have faced same but i resolved it by applying these version mismatch changes :

compileSdkVersion 24
buildToolsVersion '24.0.3'

compile 'com.android.support:appcompat-v7:23.0.1'

make sure these version are same API. Means that if you are using 24 API to build then appcompat-v7 should be 24.0.+ something.

English answered 26/5, 2017 at 13:24 Comment(1)
Thank you, I've read about APIs incompatibility and tried both upgrading (all to 24) or downgrading (all to 23) all versions/APIs with negative results :( But I'll try to unite these versions after resolving the main issue (stabilizing the app) anyway.Jens
P
2

The solution is found in this question Facebook Sdk Android Error Building

I've also forked a repo and provided all these changes to make it run with RN 0.42. You can install it by typing yarn add https://github.com/kidnapkin/react-native-fbsdk.git

Pervasive answered 26/5, 2017 at 13:49 Comment(1)
Thank you! This comment helped me the most! Mainly by linking related question, where i found solution, see below.Jens
G
1

This problem happened after libs updating, adding dependencies, version changes etc. All you need is match Sdk versions of your project, and package you just added or has been updated.

  1. Go to android/app/build.gradle

    android {
      compileSdkVersion 25
      buildToolsVersion '25.0.3'
    
      defaultConfig {
        minSdkVersion 16
        targetSdkVersion 25
    

    }

  2. Go to node_modules/your-package/android/build.gradle

    android {
      compileSdkVersion 25
      buildToolsVersion '25.0.3'
    
      defaultConfig {
       minSdkVersion 16
       targetSdkVersion 25
    

If problem will not be resolved yet, then check other packages from package.json

Thats it. Hope it helps

Gesualdo answered 8/1, 2018 at 20:8 Comment(0)
S
0

I solve that problem by only modifying android/app/build.gradle file. You need to modify the compileSdkVersion and buildToolsVersion as follows.

android {
  compileSdkVersion 25
  buildToolsVersion "25.0.1"
Syndesis answered 29/7, 2018 at 12:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.