【问题标题】:Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse' [duplicate]错误:(1)检索项目的父项时出错:找不到与给定名称“android:TextAppearance.Material.Widget.Button.Inverse”匹配的资源[重复]
【发布时间】:2016-03-18 14:49:16
【问题描述】:

我的 Android Studio 运行良好。但是当我尝试使用 Master-Detail Flow 布局创建一个新项目时,我遇到了这些错误。
现在我创建的任何项目都会给我同样的错误。

C:\Users\Lucas\Documents\PopularMovies2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1\res\values-v23\values-v23.xml
Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

我该怎么办?

这是 Gradle 文件:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.lucas.popularmovies2"
        minSdkVersion 10
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
}

谢谢。

【问题讨论】:

    标签: android gradle android-gradle-plugin


    【解决方案1】:

    如果您使用库com.android.support:appcompat-v7:23.1.1com.android.support:support-v4:23.1.1,请尝试使用buildToolsVersion,compileSdkVersiontargetSdkVersion = 23:

    ...
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    
    defaultConfig {
        applicationId "com.example.lucas.popularmovies2"
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    ...
    

    另外,您可以将 appcompat 版本更改回 22.2.1 或更低

    【讨论】:

      【解决方案2】:

      您的问题是您针对 compileSdkVersion 22 进行编译,但支持库需要版本 23 作为您的 gradle 文件。支持库适用于 sdk 版本。所以 v4:23 表示 compileSdkVersion 23。所以在 gradle compileSdkVersion 22 中更改为compileSdkVersion 23

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-01-27
        • 2016-09-28
        • 2013-10-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-27
        相关资源
        最近更新 更多