【问题标题】:Android launcher icon only appears in the emulatorAndroid 启动器图标仅出现在模拟器中
【发布时间】:2021-06-01 11:36:07
【问题描述】:

我正在尝试将启动器图标添加到我的 Android 应用程序。我已经在线观看了多个教程,这些教程解释了它是如何工作的。我最终这样做了: https://www.youtube.com/watch?v=DQ8HDL-X9rM

laucher 图标确实出现在 android 模拟器中,但不会出现在实体手机上。 我试图做的事情:

  • 在 android studio 中清理构建
  • 按照教程中的说明重置图标
  • 检查了 android manifest 中的引用
  • 检查drawable和mipmap文件夹中的图标是否改变

这是几年前在 stackoverflow 主题中出现的提示。 过去一周我一直在努力,但我无法让它发挥作用。

这是我的 ic_launcher.xml

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
   <background android:drawable="@color/ic_launcher_background"/>
   <foreground android:drawable="@mipmap/ic_launcher"/>
</adaptive-icon>

这是我的 AndroidManifest 中的行

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"

        <activity android:name="com.example.fragments.Product">
           <meta-data
              android:name="android.support.PARENT_ACTIVITY"
              android:value="com.example.MainActivity" />
        </activity>
        <activity android:name="com.example.MainActivity">
           <intent-filter>
              <category android:name="android.intent.category.LAUNCHER" />
              <action android:name="android.intent.action.MAIN" />
           </intent-filter>
        </activity>
    </application>

我还检查了所有 mipmap 文件夹,我的所有图标都在其中,名称正确。

有人知道我能做什么吗?

---更新 6 月 3 日---

现在它甚至不再出现在模拟器上...... 我已经尝试并阅读了所有在线主题我真的希望有人能发现我做错了什么

【问题讨论】:

  • 清单中的主要活动是否有intent-filter 和&lt;category android:name="android.intent.category.LAUNCHER"/&gt; &lt;action android:name="android.intent.action.MAIN"/&gt;?
  • 是的。它在 里面 它是错误的顺序然后是你发送的
  • 请在清单中发布您的入口点活动的条目。
  • 我是 android 开发新手,所以我不知道你的意思,所以我发布了整个 AndroidManifest 文件

标签: android android-emulator icons


【解决方案1】:

您可以通过简单的方式为应用添加图标

进入项目 app->res->drawable->右键->新建->图片资源->源资源 选择图像路径并单击下一步按钮 运行应用程序

another way

【讨论】:

  • 我不知道你是否会相信我,但我已经尝试了超过 5 次......但是现在在你的反应之后我又做了一次并且它有效。非常感谢你!!我确实总是点击 app -> res -> mipmap 而不是 drawable。也许这就是问题所在?
猜你喜欢
  • 2013-12-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多