You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修复Android Studio中“Monochrome icon is not defined”警告?

修复「Monochrome icon is not defined」自适应图标错误

你遇到的这个错误是因为Android 13及以上版本的主题化应用图标要求提供单色版本,而你的配置里同时存在android:icon和android:roundIcon,但其中至少一个没有指定单色图标。下面是两种直接的修复方法:

方法一:移除多余的android:roundIcon属性

打开你的AndroidManifest.xml文件,找到<application>标签,删掉其中的android:roundIcon="@mipmap/ic_launcher_round"这一行。

保留android:icon="@mipmap/ic_launcher"即可——系统会自动根据启动器的需求,从自适应图标资源中生成圆形版本,不需要单独指定roundIcon。

方法二:为两个图标都添加单色资源

如果你需要同时保留android:icon和android:roundIcon,就得给它们对应的自适应图标文件都加上单色图标配置:

  1. 先准备一张单色的图标资源(建议用矢量图,比如ic_launcher_monochrome.xml)
  2. 打开res/mipmap-anydpi-v26/ic_launcher.xml和ic_launcher_round.xml(这两个是自适应图标的定义文件)
  3. 在每个文件的<adaptive-icon>标签内,添加<monochrome>标签指向你的单色资源:
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background"/>
    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
    <!-- 新增单色图标配置 -->
    <monochrome android:drawable="@drawable/ic_launcher_monochrome"/>
</adaptive-icon>

这样启动器在需要主题化图标时,就能找到对应的单色版本,错误也就解决了。

内容的提问来源于stack exchange,提问作者ronenfe

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 22:44:55