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

使用Jetpack Compose Media3遇资源未找到错误,求修复帮助

修复Jetpack Compose Media3中notification_channel资源找不到的问题

你遇到的错误是因为项目中缺少对应的字符串资源,按以下步骤解决:

  • 确认res/values/strings.xml(或对应多语言的values子目录)中存在指定的字符串资源,添加如下内容:

    <string name="notification_channel">媒体播放通知渠道</string>
    <string name="notification_channel_description">用于展示媒体播放状态的通知渠道</string>
    

    注意资源名称必须和代码中引用的notification_channel、notification_channel_description完全一致,大小写敏感。

  • 同步项目资源:点击Android Studio顶部菜单栏的File -> Sync Project with Gradle Files,确保资源被正确识别并编译。

  • 清理重建项目:执行Build -> Clean Project后再执行Build -> Rebuild Project,清除可能存在的资源缓存问题。

  • 检查代码拼写:确认代码中R.string.notification_channel和R.string.notification_channel_description的拼写没有错误,避免因笔误导致资源找不到。

内容的提问来源于stack exchange,提问作者H M Z

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.09 17:35:26