我的flutter应用程序图标没有显示在手机应用程序列表上



我已经从flutter创建了默认(计数器)应用程序,这在出现在应用程序列表上作为一个图标,就像任何其他正常的应用程序一样完美地工作。然而,当我继续向它添加文件时,例如插件,添加了firebase,我重新构建它,应用程序启动,但应用程序图标没有显示在手机上的应用程序列表上。现在我想知道如果这是一个错误的扑动sdk或发生了什么。因为以前我使用的是flutter 2.2.2版本,现在是flutter 2.5.0

我想我弄明白了。问题是在android/app/src/main/AndroidManifest.xml。我认为您需要在意图过滤器中包含以下标记:

<category android:name="android.intent.category.LAUNCHER"/>

然而,我有一些标签覆盖了这个,这就是破坏了应用程序抽屉的可见性的原因。我的意图过滤器现在看起来如下,现在一切都在工作:

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<!-- <action android:name="android.intent.action.VIEW" /> -->
<category android:name="android.intent.category.DEFAULT" />
<!-- <category android:name="android.intent.category.BROWSABLE" /> -->
<!-- <data android:scheme="my.test.app" /> -->
</intent-filter>

希望对你有帮助。

你提供的manifest有一个<intent-filter>,它结合了从主屏幕(启动器)启动的意图和通过自定义URL方案访问的意图。

这里的问题是您将两个功能组合到单个<intent-filter>中。Android可能会把这个意图过滤器解释为它只用于处理自定义URL方案,而不是作为一个应用程序也应该出现在主屏幕上。

要解决这个问题,您应该将这两个目的分离为两个不同的<intent-filter>。你可以这样做:

<activity ...>
<!-- Intent filter for launching the app from the launcher -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

<!-- Intent filter for handling the custom URL scheme -->
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="appname" />
</intent-filter>
</activity>

相关内容