且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android Studio在同一资源文件中找不到颜色参考

更新时间:2023-11-16 18:54:40

尝试使用项目清理/编译和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.