gpt4 book ai didi

java - "ic_launcher cannot be resolved or is not a field"

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:32:53 25 4
gpt4 key购买 nike

我正在学习 Android 的教程并且完成所有操作后,我在这段代码中遇到了问题:

getDrawable(R.drawable.ic_launcher);

我收到消息了

**"ic_launcher cannot be resolved or is not a field"**

此外,我的图标没有出现在平板电脑模拟器中,但自动启动。怎么回事?

最佳答案

将“mipmap”替换为“drawable”

我在学习教程时遇到了同样的问题,我发现我的 AndroidManifest.xml 文件具有以下代码:-

android:icon="@mipmap/ic_launcher

所以我将 R.drawable 更改为 R.mipmap 它解决了问题。无论我在哪里找到 drawable,我都会用 mipmap 替换它。很高兴用 android studio 1.1 检查 mipmap。了解更多信息:- https://androidbycode.wordpress.com/2015/02/14/goodbye-launcher-drawables-hello-mipmaps/

关于java - "ic_launcher cannot be resolved or is not a field",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19385467/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com