Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load png file as SplashScreen with Android 12. #226

Closed
nicolasvanheusden opened this issue Oct 26, 2021 · 3 comments
Closed

Unable to load png file as SplashScreen with Android 12. #226

nicolasvanheusden opened this issue Oct 26, 2021 · 3 comments

Comments

@nicolasvanheusden
Copy link

nicolasvanheusden commented Oct 26, 2021

Describe the bug
Hello everyone,
I can't properly display a png file as a SplashScreen with Android 12.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new flutter project
  2. add flutter_native_splash: ^1.2.4 to pubspec.yaml
  3. add a png file in an assets directory at the project's root
  4. add in your pubspec.yaml:
    `
    assets:
    • assets/
      `
  5. add this in your pubspec.yaml :
    flutter_native_splash: color: "#fddcc2" image: assets/splash_screen.png android: true android12: true ios: true android_gravity: fill ios_content_mode: scaleAspectFill
  6. remove in android manifest : <meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
  7. update in android/app/build.gradle :
    android { compileSdkVersion 31 ... defaultConfig { ... targetSdkVersion 31 ... } }
  8. pub.get
  9. run flutter pub run flutter_native_splash:create
  10. launch the app

Expected behavior
Only a white screen appear as SplashScreen !

Device :

  • Device: simulator Pixel 4 API 31 ARM
  • OS: Android S

Flutter doctor
`
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale
fr-FR)
• Flutter version 2.5.3 at /Users/nicolasvanheusden/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (il y a 11 jours), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/nicolasvanheusden/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.0, Build version 13A233
• CocoaPods version 1.11.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] IntelliJ IDEA Community Edition (version 2021.2.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 61.2.4
• Dart plugin version 212.5486

[✓] VS Code (version 1.61.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.27.0

[!] Connected device
! No devices available

! Doctor found issues in 2 categories.
`

Additional context
Now, if you re-add the line removed from androidManifest.xml, the png appear after a white screen.
Then, if you modified styles.xml in values-v31 and values-night-v31 folder :
this line :
<item name="android:windowSplashScreenBackground">#fddcc2</item>
instead of :
<item name="android:windowSplashScreenBackground">@drawable/launch_background</item>
Now you see the correct color before your splashScreen png file but I had to use a deprecated splashscreen.

So how can I do this without a deprecated solution ?
Thank you

@jonbhanson
Copy link
Owner

Thanks for the report. I will push an update soon to add Android 12 support.

@aqueebqazi
Copy link

hey its not working on android 13

@jonbhanson
Copy link
Owner

@aqueebqazi please open a new ticket and supply the information requested in the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants