flutter android app freezes on the splash screen in release mode

655

Solution 1

I had the same problem in our production app few days back. I released an update (where just a couple of tables were updated in the local app database) with Flutter 2.10.2 and many users started getting frozen launch screen.

After spending days trying to solve it, I finally downgraded the Flutter to 2.8 and released an update and the issue was gone.

Solution 2

You could install sentry_flutter in your application to capture exceptions in your release app.

Also, try moving flutter_native_splash: ^2.0.4 from dev_dependencies to dependencies.

Share:
655
user1080247
Author by

user1080247

php mysql developer codeigniter tutorial codeigniter clean url codeigniter-tutorials

Updated on January 03, 2023

Comments

  • user1080247
    user1080247 over 1 year

    I have a problem using the storage to persist the user login data .

    the scenario like that : after login , I clear the app and try to reopen it again , sometimes it open and sometimes it's freezes on the splash screen. this only happen in the release mode .

    I tried to remove every package until I found the problem with using the storage after login. so I if I not login nothing freezes .

    I used get_storage and shared_preferences and secured_storage packages but nothing changed . flutter 2.10.2.

    tested on real device

    also this the the used packages

    module:
      androidX: true # Add this line.
    
    environment:
      sdk: ">=2.11.0 <3.0.0"
    
    dependencies:
      dio: ^4.0.0
      get: ^4.1.4
      get_storage:
      flutter:
        sdk: flutter
    
    
    dev_dependencies:
      flutter_launcher_icons: ^0.9.2
    
    flutter_icons:
      android: true
      ios: false
      image_path: "assets/icons/launcher_icon.png"
      flutter_test:
        sdk: flutter
    
    name: delivery
    description: manager App
    version: 1.6.3
    publish_to: 'none' # Remove this line if you wish to publish to pub.dev
    

    finally I decided to share the verbose hope someone can help

    https://github.com/flutter/flutter/issues/98862

    • Vandad Nahavandipoor
      Vandad Nahavandipoor about 2 years
      Is this freezing only on an emulator? Have you tested this on a real device as well?
    • user1080247
      user1080247 about 2 years
      it's freezes on real device when use release mode , but in debug mode no problem
    • Nerdy Bunz
      Nerdy Bunz about 2 years
      You could try 1) removing components until it works... or 2) print debugging each step so you know where it gets stuck. This won't fix the problem but it will tell you what the problem is.
    • user1080247
      user1080247 about 2 years
      about 1 , the stuck happen after login and clear all apps and then run the app , which means something happen with the login storage , but i can not remove the storage about 2 , nothing shown in the logcat or in the run or any exception
    • Ujjawal Maurya
      Ujjawal Maurya about 2 years
      There might be some permission issue like internet. make sure you have mentioned them. Another way to find out problem is via logs. use flutter logs command and connect your device via cable and run release version of your app after installing it. Check for logs. hope it will help
    • ישו אוהב אותך
      ישו אוהב אותך about 2 years
      shouldn't flutter_native_splash in dependencies: block instead of dev_dependencies:?
    • Jasmin Sojitra
      Jasmin Sojitra about 2 years
      Remove flutter_native_splash: ^2.0.4 plugin and try with medium.com/flutter-clan/…
    • user1080247
      user1080247 about 2 years
      i removed it and try with a new flutter project without any splash screen but it's still stopped on the black splash screen without any error
  • user1080247
    user1080247 about 2 years
    i use this command flutter run --release after the app running there is no way to run any other command until stop the execution , so there is no way to use flutter logs or any command
  • Ujjawal Maurya
    Ujjawal Maurya about 2 years
    when flutter build completes, install app to you phone. then connect it to your machine and open new and fresh session/instance of terminal/command prompt and then run flutter logs. Then start your app from that device you've installed app on. You will see logs in terminal. (Make sure to enable usb debugging in Developer options)
  • user1080247
    user1080247 about 2 years
    nothing , no error in the log
  • user1080247
    user1080247 about 2 years
    after adding the three lines i show this error * What went wrong: A problem occurred evaluating project ':app'. > No signature of method: build_1icb3k0ev7h17j94toyq7e1sh.android() is applicable for argument types: (build_1icb3k0ev7h17j94toyq7e1sh$_run_closure3) values: [build_1icb3k0ev7h17j94toyq7e1sh$_run_closure3@392a11c2]
  • user1080247
    user1080247 about 2 years
    i am already using it but it not catch any error , because actually there is no exception , just the app stopped in the splash screen and display this message { app not responding }
  • user1080247
    user1080247 about 2 years
    also i removed flutter_native_splash and start new project from scratch without any splash configation but it still stopped on the the black screen untill show this message {app not responding }
  • Vishal Agrawal
    Vishal Agrawal about 2 years
    then you must try a new project and try to run that with adding anything, also before that run the command flutter doctor -v in the terminal
  • user1080247
    user1080247 about 2 years
    that what i told above , i started new project from scratch but still hang on the default black splash without any issue in the log
  • Vishal Agrawal
    Vishal Agrawal about 2 years
    You are running your app on emulator or on the real device?
  • user1080247
    user1080247 about 2 years
    real device using the release mode , the debug mode worked correctly
  • Vishal Agrawal
    Vishal Agrawal about 2 years
    if you getting that error after adding those 3 lines please check this post stackoverflow.com/questions/61807520/…
  • user1080247
    user1080247 about 2 years
    after adding the three lines and fixed the issue , nothing changed thank you
  • jon
    jon about 2 years
    @user1080247 I added another suggestion to my answer.
  • user1080247
    user1080247 about 2 years
    I already removing it when trying to fix this issue but it still remaining
  • Abhishek Dutt
    Abhishek Dutt about 2 years
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
  • user1080247
    user1080247 about 2 years
    thanks i updated the question to clarify what going on exactly @AbhishekDutt
  • user1080247
    user1080247 about 2 years
    the issue happen only after login , i updated the answer for more clear
  • user1080247
    user1080247 about 2 years
    thank you @Mohammad Tanvir Parvez , after couple of days and about 100 tries for all solutions , your suggestion the only one worked for me .