jonbhanson / flutter_native_splash

Automatically generates native code for adding splash screens in Android and iOS. Customize with specific platform, background color and splash image.
https://pub.dev/packages/flutter_native_splash
MIT License
1.28k stars 200 forks source link

A lot of messages after adding the splash screen. #221

Closed intercretasyo closed 2 years ago

intercretasyo commented 2 years ago

Describe the bug More than a hundred of these lines are found: I/ViewRootImpl@50e8af1MainActivity: [DP] cancelDraw io.flutter.embedding.android.FlutterActivityAndFragmentDelegate$2@5fb73dc isViewVisible: true

Device (please complete the following information):

Flutter doctor [✓] Flutter (Channel stable, 2.5.1, on macOS 11.5.2 20G95 darwin-x64, locale en-US) • Flutter version 2.5.1 at /Users/myPC/Developer/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ffb2ecea52 (10 days ago), 2021-09-17 15:26:33 -0400 • Engine revision b3af521a05 • Dart version 2.14.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/myPC/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-7281165) • 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.10.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] 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-7281165)

[✓] Connected device (2 available) • SM G970F (mobile) • RF8M620YCCW • android-arm64 • Android 11 (API 30) • Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.82

• No issues found!

Additional context When I removed this code, the issue is happening. <meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />

SeriousMonk commented 2 years ago

Same, how does one solve this?

puze commented 2 years ago

I am also having the same problem.

jonbhanson commented 2 years ago

@intercretasyo @SeriousMonk @puze can you provide more information?

@SeriousMonk @puze can you add your Flutter Doctor output?

Is the problem on Android 11? Are the error message happening when you run your app after having previously added the splash screen? Do the errors happen during the splash screen or after the app loads?

I am not able to reproduce these errors. Can you supply me with a means to reproduce the errors?

CarloDotLog commented 2 years ago

Hello all, I have replicated this error.

First, create a new Flutter project and import the flutter_native_splash library. When you build and run the app, in the log, you will find this warning:

W/FlutterActivityAndFragmentDelegate(27508): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.

So, remove the deprecated code, as shown in the guide..

when you build and run the app, you will find these errors:

I/ViewRootImpl@5d03b84MainActivity: [DP] cancelDraw io.flutter.embedding.android.FlutterActivityAndFragmentDelegate$2@3d78bf0 isViewVisible: true

.. tadaaan :)

For now, I've decided to ignore the deprecation warning and place this code, inside the manifest.

<!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />

@jonbhanson Could you please let us know how to resolve the issue?

Than you, Carlo.

jonbhanson commented 2 years ago

Thanks for the instructions, @CarloDotLog, but unfortunately I still cannot reproduce the problem. Here is what I did:

  1. Created a new Flutter project with default settings.
  2. In pubspec.yaml, add flutter_native_splash: ^1.3.0 under dev_dependencies
  3. At the end of pubspec.yaml, add:
    flutter_native_splash:
    color: "#42a5f5"
  4. Run flutter pub get
  5. Create the splash screen with the command: flutter pub run flutter_native_splash:create
  6. Remove the following from android/app/src/main/AndroidManifest.xml:
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
  7. Debug on Pixel 2 XL running Android 11
  8. Check the output of the debug console. Here is my output:
    Launching lib/main.dart on Pixel 2 XL in debug mode...
    Running Gradle task 'assembleDebug'...
    ✓  Built build/app/outputs/flutter-apk/app-debug.apk.
    Installing build/app/outputs/flutter-apk/app.apk...
    Debug service listening on ws://127.0.0.1:54428/OJvx2wnmt4o=/ws
    Syncing files to device Pixel 2 XL...
    I/Gralloc4(17407): mapper 4.x is not supported
    W/Gralloc3(17407): mapper 3.x is not supported

    I don't see the error that you are seeing. Are these the same steps that you took to reproduce this error? Please include your flutter doctor -v output

Flutter Doctor output `[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-x64, locale en-US) • Flutter version 2.5.3 at /Users/jonhanson/Projects/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (12 days ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) • Android SDK at /Users/jonhanson/Library/Android/sdk • Platform android-31, build-tools 30.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165) • 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.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] 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-7281165) [✓] VS Code (version 1.61.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (3 available) • Pixel 2 XL (mobile) • 710KPCA0397787 • android-arm64 • Android 11 (API 30) • macOS (desktop) • macos • darwin-x64 • macOS 11.6 20G165 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.54 `
CarloDotLog commented 2 years ago

Thank you for your reply @jonbhanson.

I confirm that if I retry the steps, I enable/disable the errors.

Without this code in the manifest file

             <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />

I have the errors and a long time white screen.

I've tested on Pixel 4 (Emulator) with Android 11 and a SM A405FN (device) with Android 11 and I had the same errors.

There is my flutter doctor -v output:

Flutter doctor output [✓] Flutter (Channel stable, 2.5.3, on Mac OS X 10.15.7 19H1519 darwin-x64, locale it-IT) • Flutter version 2.5.3 at /Users/carlo.loguercio/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (12 days ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/carlo.loguercio/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.1) • 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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.61.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.24.0 [✓] Connected device (3 available) • SM A405FN (mobile) • R58M94PT37V • android-arm64 • Android 11 (API 30) • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.7 19H1519 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.54 • No issues found!
jonbhanson commented 2 years ago

Is anyone still experiencing this problem? It seems there was a rash of these in October, and then no more. Maybe it was related to a Flutter update that had a problem and was subsequently patched?

jonbhanson commented 2 years ago

Closed due to inactivity. Feel free to reopen if you are still having a problem.

haslinger commented 2 years ago

@jonbhanson I can confirm, that I see these messages now with my app Encrateia that I am currently updating, after having removed meta-data as above from the Android.manifest.

I am developing using flutter installed via snap within Ubuntu; flutter doctor -v outputs:

flutter doctor -v
[✓] Flutter (Channel stable, 2.10.1, on Ubuntu 20.04.4 LTS 5.4.0-104-generic, locale en_US.UTF-8)
    • Flutter version 2.10.1 at /home/stefan/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db747aa133 (4 weeks ago), 2022-02-09 13:57:35 -0600
    • Engine revision ab46186b24
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
    • Android SDK at /home/stefan/Android/Sdk
    • Platform android-32, build-tools 33.0.0-rc1
    • ANDROID_HOME = /home/stefan/Android/Sdk
    • Java binary at: /snap/android-studio/119/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /snap/android-studio/119/android-studio
    • Flutter plugin version 65.2.2
    • Dart plugin version 211.7808
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.65.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.36.0

[✓] Connected device (2 available)
    • SM T510 (mobile) • R52MC17S20J • android-arm    • Android 11 (API 30)
    • Chrome (web)     • chrome      • web-javascript • Google Chrome 99.0.4844.51

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Edit: found open issue in the flutter repo for this. Sorry for the noise.

dk-crazydiv commented 2 years ago

Facing the same issue on Samsung M31, API31. The issue isn't reproducible on pixel devices. Reading the comments above, adding the deprecated metadata to AndroidManifest.xml manually shows a deprecation warning

W/FlutterActivityAndFragmentDelegate( 1202): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.

and removes the message

I/ViewRootImpl@3aca0baMainActivity: [DP] cancelDraw null isViewVisible: true