The color "XXX" in values has no declaration in the base values folder; this can lead to crashes when the resource is queried in a configuration that does not match this qualifier

Rename /res/values/colors.xml 中的颜色名称时,出现了下列错误:

The color "XXX" in values has no declaration in the base values folder; this can lead to crashes when the resource is queried in a configuration that does not match this qualifier 

问了两个AI,都说“颜色资源 XXX 在特定配置的 values 文件夹(如 values-v21)中声明了,但在基础 values 文件夹(即默认的 res/values/)中没有声明.这可能导致在某些设备配置下应用崩溃.”,奇怪了,我就是在默认的 res/values/ 中定义的,结果这是Android Studio自身的错误引起的,解决方法是: File-->Invalidate Caches-->Invalidate and Restart,清除缓存,重启Android Studio后就正常了.

posted @ 2025-07-19 16:19  MSTK  阅读(23)  评论(0)    收藏  举报