Android AAPT: error: resource color 异常原因处理

异常体现:

复制代码
Android resource linking failed
ERROR:E:\software\Developer\APP\GaoDeTest2\app\src\main\res\values\themes.xml:3:5-9:13: AAPT: error: resource color/purple_500 (aka com.example.gaodetest2:color/purple_500) not found.
    
ERROR:E:\software\Developer\APP\GaoDeTest2\app\src\main\res\values\themes.xml:3:5-9:13: AAPT: error: resource color/purple_700 (aka com.example.gaodetest2:color/purple_700) not found.
    
ERROR:E:\software\Developer\APP\GaoDeTest2\app\src\main\res\values\themes.xml:3:5-9:13: AAPT: error: resource color/teal_200 (aka com.example.gaodetest2:color/teal_200) not found.
    
ERROR:E:\software\Developer\APP\GaoDeTest2\app\src\main\res\values-night\themes.xml:3:5-9:13: AAPT: error: resource color/purple_200 (aka com.example.gaodetest2:color/purple_200) not found.
    
ERROR:E:\software\Developer\APP\GaoDeTest2\app\src\main\res\values-night\themes.xml:3:5-9:13: AAPT: error: resource color/purple_700 (aka com.example.gaodetest2:color/purple_700) not found.
    
ERROR:E:\software\Developer\APP\GaoDeTest2\app\src\main\res\values-night\themes.xml:3:5-9:13: AAPT: error: resource color/teal_200 (aka com.example.gaodetest2:color/teal_200) not found.

该异常是删除了项目创建时系统引用的颜色资源,导致的编译失败异常;

异常解决:

根据提示在color.xml里加入报错的颜色资源

html 复制代码
    <color name="purple_200">#FFBB86FC</color>
    <color name="purple_500">#FF6200EE</color>
    <color name="purple_700">#FF3700B3</color>
    <color name="teal_200">#FF03DAC5</color>
    <color name="teal_700">#FF018786</color>

上面只是举例,报错的颜色和本文不对应的话,以你报错的日志中的颜色决定加入的颜色名

相关推荐
知行合一。。。1 小时前
DeepAgents--01--Agent和OpenClaw的相关概念
android·数据库
汪海游龙2 小时前
告别 Play Console 手动上传:从模拟器截图到自动发版的完整流水线
android·ci/cd·github
weixin_440784112 小时前
【IntentSeivice实现原理】
android·java·开发语言·intentservice
delta_hell2 小时前
【阅读源码--Android】动画之ValueAnimator--2
android·源码·valueanimator
delta_hell2 小时前
【阅读源码--Android】动画之辅助类
android·源码·animator
消失的旧时光-19436 小时前
第 2 篇:Android 控制屏为什么与机器人主控使用 TCP 长连接?
android·tcp/ip·机器人
小Ti客栈7 小时前
MySQL查询原理:从Server到InnoDB
android·mysql·adb
纪念 2298 小时前
MySQL(题目讲解二)
android·数据库·mysql
你听得到118 小时前
排查 App 问题:别只盯着报错,把前后发生的事情串起来
android·前端·flutter
淡淡的香烟9 小时前
Android智能猫砂盆视频加载慢卡顿问题分析
android·服务器·音视频