添加Google Play服务相关性会导致“检索项目的父项时出错”

时间:2017-11-12 19:18:08

标签: android google-play-services android-support-library

在模拟器中启动我的应用时,我一直遇到错误:

Error:(3) Error retrieving parent for item: No resource found that matches 
the given name 
'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches 
the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
Error:(3) Error retrieving parent for item: No resource found that matches 
the given name 
'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches 
the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

我正在使用API​​ 23,我看到类似的帖子有关SDK版本需要与支持库匹配。

但是,我所做的就是创建项目,然后添加Google Play服务依赖项,然后尝试运行我的应用程序,我就会收到这些错误。

下面是我的build.grade文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "jamiefuller.myapplication"
        minSdkVersion 23
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services:11.0.4'
}

1 个答案:

答案 0 :(得分:1)

您无法使用api 23进行编译,因为您使用的是编译'com.google.android.gms:play-services:11.0.4'(它与支持库有依赖关系)。

使用:

compileSdkVersion 26