【问题标题】:Launcher Icon is not visible for Flutter App. on Menu启动器图标对于 Flutter 应用程序不可见。在菜单上
【发布时间】:2020-06-23 10:46:56
【问题描述】:

我有以下 pubspec.yaml 文件,当我执行 flutter run 时,它会在设备上启动应用程序,但我在手机的菜单列表中看不到启动器图标。 我的手机是安卓7

name: simpleapp
description: Simple App
version: 1.0.0+1
environment:
  sdk: ">=2.1.0 <3.0.0"
dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
dev_dependencies:
  flutter_test:
    sdk: flutter
flutter:
  uses-material-design: true

【问题讨论】:

  • 检查AndroidMenifest.xml,你应该有图标和标签

标签: flutter


【解决方案1】:

您可以使用flutter_launcher_icons,它会在您的终端中用一个命令替换 iOS 和 Android(以及带有自适应图标的 Android 8.0 及更高版本)的每个图标 ?

【讨论】:

    【解决方案2】:
    • 将flutter_launcher_icons 包添加到您的 pubspec.yaml 文件中
    • 在 pubspec.yaml 文件中指定您希望用于应用程序的图标的路径,然后选择是否要将图标用于 iOS 应用程序、Android 应用程序或两者。
    • 运行包
    • 给你!

    【讨论】:

      【解决方案3】:

      下次我有这个(第二次应用,第二次......)更多信息在 android > app > src > main > AndroidManifest.xml:

                  android:name=".MainActivity"
                  android:exported="true"
                  android:launchMode="singleTop"
                  android:theme="@style/LaunchTheme"
                  android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
                  android:hardwareAccelerated="true"
                  android:windowSoftInputMode="adjustResize">
                  <!-- Specifies an Android theme to apply to this Activity as soon as
                       the Android process has started. This theme is visible to the user
                       while the Flutter UI initializes. After that, this theme continues
                       to determine the Window background behind the Flutter UI. -->
                  <meta-data
                    android:name="io.flutter.embedding.android.NormalTheme"
                    android:resource="@style/NormalTheme"
                    />
                  <intent-filter>
                      <action android:name="android.intent.action.MAIN"/>
                      <category android:name="android.intent.category.LAUNCHER"/>
                  </intent-filter>
              </activity>
      

      android:name="io.flutter.embedding.android.NormalTheme" 必须保持原样。它引用了 Flutter 来让幕后发生一些神奇的事情......

      【讨论】:

        猜你喜欢
        • 2019-04-07
        • 2013-12-02
        • 1970-01-01
        • 2014-12-14
        • 1970-01-01
        • 2014-08-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多