简体   繁体   English

Flutter launcher_icon 和 native_splash android 问题

[英]Flutter launcher_icon and native_splash android problem

I am beginner in flutter, and I started learning from the very beginning of creating the application and immediately encountered a problem that I cannot solve only on android.我是 flutter 的初学者,我从创建应用程序的一开始就开始学习,并立即遇到了一个我无法仅在 android 上解决的问题。 When i create packages launcher_icon and native_splash, on ios everything works as it should, but on android at the splash screen all the time it gives me only the application icon and not default splash screen as in ios.当我创建包 launcher_icon 和 native_splash 时,在 ios 上一切正常,但在 android 上,它始终在初始屏幕上给我只有应用程序图标,而不是像 Z9E304D4E8DF1B74CFA0.99913 中那样的默认初始屏幕

how could i fix it to work on android?我该如何修复它以在 android 上工作?

    dev_dependencies:
     flutter_test:
    sdk: flutter


  flutter_lints: ^2.0.0

  flutter_launcher_icons: ^0.10.0

  flutter_native_splash: ^2.2.7

flutter_icons:
  android: true
  ios: true
  image_path: "assets/icon_anny.png"
  min_sdk_android: 21

flutter_native_splash:
  color: "#fafafa"
  image: assets/splash_screen.png
  color_dark: "#000000"
  image_dark: assets/splash_screen_dark.png
  android: true
  ios: true
  android_gravity: fill
  ios_content_mode: scaleAspectFill

You should run a command line after adding parameters to pubspec.yaml :您应该在向pubspec.yaml添加参数后运行命令行:

flutter pub run flutter_native_splash:create

I just fixed this problem today go in your project and create a flutter_native_splash.yaml and follow the instructions on https://pub.dev/packages/flutter_native_splash .我今天刚刚在你的项目中解决了这个问题 go 并创建了一个 flutter_native_splash.yaml 并按照Z5E056C500A1C4B6A7110B50D807BADE_native_splash.dev上的说明进行操作。

I managed to solve the problem, Android 12 has a different way of showing the splash screen.我设法解决了这个问题,Android 12 有不同的显示启动画面的方式。 It is also necessary to open a new one flutter_native_splash.yaml and there are all the instructions and it works perfectly.还需要打开一个新的flutter_native_splash.yaml,里面有所有的指令,它工作得很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM