异常体现:
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里加入报错的颜色资源文章来源:https://www.toymoban.com/news/detail-702815.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>
上面只是举例,报错的颜色和本文不对应的话,以你报错的日志中的颜色决定加入的颜色名文章来源地址https://www.toymoban.com/news/detail-702815.html
到了这里,关于Android AAPT: error: resource color 异常原因处理的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!