如何在 flutter 中更改 android 图标?
How to change android icon in flutter?
在 运行 一个 flutter 应用程序之后,它被正确部署到 Android 虚拟设备。
在虚拟设备中,我注意到为该应用选择的图标在其他现有应用中正确显示。
但是,当我点击查看 运行 进程时,Android 图标出现在 flutter 应用 window 的顶部。
已按照说明手动添加图标 here。
如何更改此默认图标以使用我的图标?
我最喜欢的库之一,您可以使用
它将为您生成 iOS 和 android 图标
https://pub.dev/packages/flutter_launcher_icons
再次检查您的AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.snapio">
<application
android:name="io.flutter.app.FlutterApplication"
android:label="flutter"
android:icon="@mipmap/ic_launcher">
您必须更改此文件中的图标名称。
对于 Android10,您必须提供自适应图标才能在任务切换器中显示。更多信息在这里:https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive
通过设置 flutter_icons[,从 pubspec.yaml 更改 flutter 中的应用程序图标=26=] 标签如下:
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "images/icon/icon.png" # your full path in assets directory
在pubspec.yaml中添加flutter_launcher_icons作为开发依赖
dev_dependencies:
flutter_launcher_icons: "^0.9.2"
最后更新依赖并生成图标
flutter pub get
flutter pub run flutter_launcher_icons:main
在 运行 一个 flutter 应用程序之后,它被正确部署到 Android 虚拟设备。
在虚拟设备中,我注意到为该应用选择的图标在其他现有应用中正确显示。
但是,当我点击查看 运行 进程时,Android 图标出现在 flutter 应用 window 的顶部。
已按照说明手动添加图标 here。
如何更改此默认图标以使用我的图标?
我最喜欢的库之一,您可以使用 它将为您生成 iOS 和 android 图标 https://pub.dev/packages/flutter_launcher_icons
再次检查您的AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.snapio">
<application
android:name="io.flutter.app.FlutterApplication"
android:label="flutter"
android:icon="@mipmap/ic_launcher">
您必须更改此文件中的图标名称。
对于 Android10,您必须提供自适应图标才能在任务切换器中显示。更多信息在这里:https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive
通过设置 flutter_icons[,从 pubspec.yaml 更改 flutter 中的应用程序图标=26=] 标签如下:
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "images/icon/icon.png" # your full path in assets directory
在pubspec.yaml中添加flutter_launcher_icons作为开发依赖
dev_dependencies:
flutter_launcher_icons: "^0.9.2"
最后更新依赖并生成图标
flutter pub get
flutter pub run flutter_launcher_icons:main