找不到与给定名称匹配的资源(在'color'处,值为'@ color/common_signin_btn_light_text_pressed') [英] No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_light_text_pressed')

查看:125
本文介绍了找不到与给定名称匹配的资源(在'color'处,值为'@ color/common_signin_btn_light_text_pressed')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前使用Android Studio 1.1构建了我的应用.那时我没有问题.升级后,当我尝试重建应用程序时出现以下错误.

I have built my app earlier using the Android studio 1.1. I had no problems then. After upgrading I am getting the following error when I try to rebuild my app.

D:\-----\src\main\res\color\common_signin_btn_text_dark.xml
Error:(4, 55) No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_dark_text_pressed').
Error:(5, 85) No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_dark_text_disabled').
Error:(6, 55) No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_dark_text_focused').
Error:(7, 56) No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_dark_text_disabled').
Error:(8, 26) No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_dark_text_default').
D:\-------\src\main\res\color\common_signin_btn_text_light.xml
Error:(4, 55) No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_light_text_pressed').
Error:(5, 85) No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_light_text_disabled').
Error:(6, 55) No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_light_text_focused').
Error:(7, 56) No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_light_text_disabled').
Error:(8, 26) No resource found that matches the given name (at 'color' with value '@color/common_signin_btn_light_text_default').
Error:Execution failed for task ':colorBookPro:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Admin\AppData\Local\Android\sdk1\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1

我尝试搜索解决方案,但找不到任何解决方案.这是我的build.gradle文件

I tried to search for solutions but couldn't find any solution. This is my build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'    

    defaultConfig {
        applicationId "com.demo"
        minSdkVersion 10
        targetSdkVersion 18
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile project(':main')
    compile project(':library')
    compile 'com.google.android.gms:play-services:8.3.0'
    compile files('libs/StartAppInApp-2.4.7.jar')
}

文件位于res/color文件夹中,如下所示. 单击此处获取图像 我还尝试使用API​​ 23和构建工具23.0.1和许多其他选项.我似乎不了解这个问题,因为它不是第一次存在. 我在两个月前构建了该应用程序.我是编码新手,所以如果我写了任何愚蠢的东西,请多多包涵.我希望有一个人可以帮助我.

The files are in the res/color folder like this. click here for image I also tried using API 23 and build tools 23.0.1 and many other options. I don't seem to understand the problem as it didn't exist the first time. I built the app 2 months back. I am new to coding so please bear with me if I have written anything silly. I hope someone can help me.

谢谢.

推荐答案

感谢所有您的建议,但不幸的是,这些建议均无效.我终于通过用

Thanks all for your suggestions but unfortunately none of them worked. I finally solved the error by replacing the color sources in common_signin_button_text_light.xml with

<item android:state_pressed="true" android:color="@color/common_google_signin_btn_text_light_pressed" />
    <item android:state_focused="true" android:state_enabled="false" android:color="@color/common_google_signin_btn_text_light_disabled" />
    <item android:state_focused="true" android:color="@color/common_google_signin_btn_text_light_focused" />
    <item android:state_enabled="false" android:color="@color/common_google_signin_btn_text_light_disabled" />
    <item android:color="@color/common_google_signin_btn_text_light_default" />

和common_signin_button_text_dark.xml与

and common_signin_button_text_dark.xml with

<item android:state_pressed="true" android:color="@color/common_google_signin_btn_text_dark_pressed" />
    <item android:state_focused="true" android:state_enabled="false" android:color="@color/common_google_signin_btn_text_dark_disabled" />
    <item android:state_focused="true" android:color="@color/common_google_signin_btn_text_dark_focused" />
    <item android:state_enabled="false" android:color="@color/common_google_signin_btn_text_dark_disabled" />
    <item android:color="@color/common_google_signin_btn_text_dark_default" />

似乎资源文件在更新Android Studio后也会更新.

It seems the resources files update after updating Android Studio.

做出上述更改后,我能够成功构建我的应用程序.

I was able to successfully build my app after making above changes.

这篇关于找不到与给定名称匹配的资源(在'color'处,值为'@ color/common_signin_btn_light_text_pressed')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆