检索项目的父项时出错:找不到与给定名称匹配的资源

时间:2017-05-16 17:11:52

标签: java android gradle google-play-services

请不要将此问题标记为重复...我无法在其他帖子上找到解决方案,尤其是this one ... :(

启动应用时出现以下错误:

/build/intermediates/res/merged/debug/values-v23/values-v23.xml
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

以下是应用级别的Gradle:

android {
    compileSdkVersion 22 
    buildToolsVersion '25.0.2' 
    useLibrary  'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.tasmanic.radio.fm"
        minSdkVersion 14 
        targetSdkVersion 22
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {

    compile 'com.android.support:support-v4:22.2.1' 
compile 'com.android.support:support-v4:22.2.1'
    compile 'com.android.support:animated-vector-drawable:22.2.1'
    compile 'com.android.support:appcompat-v7:22.2.1'

    compile files('libs/libGoogleAnalyticsServices.jar')

    compile 'com.google.android.gms:play-services-analytics:10.2.1' 
    compile 'com.google.android.gms:play-services-ads:10.2.1'

    compile 'com.google.firebase:firebase-core:10.2.1'
    compile 'com.google.firebase:firebase-messaging:10.2.1'
    compile 'com.google.firebase:firebase-config:10.2.1'


    compile 'com.android.support:recyclerview-v7:22.2.1'
    compile fileTree(dir: 'libs', include: ['*.jar'])


}

apply plugin: 'com.google.gms.google-services'

在项目层面:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1' 
        classpath 'com.google.gms:google-services:3.0.0'

    }
}

请注意,我希望将targetSdkVersion保持为22。

关于如何解决这个问题的任何想法?

谢谢!!!

2 个答案:

答案 0 :(得分:1)

Google Play服务/ Firebase 10.2.1取决于Android支持库的24.0.0版,您可以通过运行gradlew androidDependencies来查看。

这意味着必须使用API​​ 24或更高版本进行编译。这样做意味着您必须定位API 24或更高版本,如this blog post中所述。

依赖于v22版支持库的最新版Google Play服务是8.4.0,其中不包含任何Firebase功能(10.0.0中引入)。

答案 1 :(得分:0)

尝试将Widget.Material更改为样式文件中的Theme.AppCompat,其匹配api级别< 21