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里加入报错的颜色资源

    #FFBB86FC
    #FF6200EE
    #FF3700B3
    #FF03DAC5
    #FF018786

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

你可能感兴趣的:(android)