Android Studio在同一资源文件中找不到颜色参考 [英] Android Studio can't find color reference within the same resource file

查看:171
本文介绍了Android Studio在同一资源文件中找不到颜色参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的资源文件 \ res \ values \ colors.xml 的内容:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="themeGray">#ff8A9199</color>
    <color name="themeLightGray">#ffeaeaea</color>
    <color name="themeDarkGray">#ff3f434b</color>
    <color name="themeRed">#ffCC292B</color>
    <color name="themeBlue">#ff002E63</color>
    <color name="themeWhite">#ffffffff</color>
    <color name="buttonNormal">@color/themeGray</color>
    <color name="buttonPressed">@color/themeBlue</color>
</resources>

两个值

@color/themeGray
@color/themeBlue

为红色无法解析符号'@ color/themeGray'

编辑

这是我在消息"窗口中看到的:

Error:Execution failed for task ':app:mergeDebugResources'.
> java.lang.NullPointerException (no error message)

解决方案

尝试使用项目清理/编译和File> Invalidate Caches/Restart ...失败后,我解决了将项目重定位到另一个文件夹的问题./p>

Here's the content of my resource file \res\values\colors.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="themeGray">#ff8A9199</color>
    <color name="themeLightGray">#ffeaeaea</color>
    <color name="themeDarkGray">#ff3f434b</color>
    <color name="themeRed">#ffCC292B</color>
    <color name="themeBlue">#ff002E63</color>
    <color name="themeWhite">#ffffffff</color>
    <color name="buttonNormal">@color/themeGray</color>
    <color name="buttonPressed">@color/themeBlue</color>
</resources>

The two values

@color/themeGray
@color/themeBlue

are red colored Cannot resolve symbol '@color/themeGray'

EDIT

This what I see in the Message windows:

Error:Execution failed for task ':app:mergeDebugResources'.
> java.lang.NullPointerException (no error message)

解决方案

After trying with project clean/compile and File>Invalidate Caches / Restart... with no success, I solved the problem relocating the project to another folder.

这篇关于Android Studio在同一资源文件中找不到颜色参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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