本文介绍了检索项目的父项时出错:找不到与给定名称'android:TextAppearance.Material.Widget.Button.Colored'相匹配的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我遇到这篇文章中提到的错误:在获取父项时出错:找不到与给定名称'android:TextAppearance.Material.Widget.Button.Borderless.Colored'匹配的资源

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'

有趣的是(与众不同之处是)我们的应用程序投入生产需要5个月,到目前为止,我们已经制作了数百个版本和APK.我们一周都没有更改任何一行代码(两个库版本均未更改),并且该版本突然停止处理此提到的错误.

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'.

使用这些版本的库(package.json):

Using these versions of libraries (package.json):

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

我们的build.gradle(不是完整的),一直运行到现在:

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

请问有什么想法吗?

推荐答案

最后,我找到了解决方案.阅读所有答案和相关问题( Facebook Sdk Android错误构建)并尝试了许多操作(库更新,依赖项,许多版本更改)等等.)我设法再次构建了我的应用程序.然后,我还原了所有不必要的更改,剩下了什么:

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:

我需要在我的 android/build.gradle 文件(不是android/app/build.gradle)中添加2项内容(迭代器和带有"force"的行) :

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

仍然感谢所有提示!

这篇关于检索项目的父项时出错:找不到与给定名称'android:TextAppearance.Material.Widget.Button.Colored'相匹配的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 05:19