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

KMP/CMP项目中无法使用Icons.Rounded.*图标组件的问题求助

KMP/CMP项目中无法使用Icons.Rounded.*图标组件的问题求助

我最近在KMP/CMP项目里碰到个棘手的小问题——明明已经配置了依赖、也导入了正确的包,却没法使用Icons.Rounded.Settings这类图标组件。之前在纯Android项目里用这套操作完全没问题,但到了跨平台项目就失效了,有没有大佬能帮忙分析下原因,给我指条解决的路子呀?

以下是我的配置和代码细节:

依赖配置(build.gradle.kts)

implementation("org.jetbrains.compose.material:material-icons-extended:1.10.0")

代码导入(MainScreen.kt)

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Settings

图标使用代码(MainScreen.kt)

...
Icon(
    Icons.Rounded.Settings,
    null
)

目前的报错情况是:导入语句里的icons,还有Icon组件调用里的Icons都被标红识别为错误,完全没法正常编译运行。

麻烦各位大佬帮忙看看啦,谢谢大家!
😉

备注:内容来源于stack exchange,提问作者i-am-i

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.13 18:03:15