10

Flutter android release build is stuck on splash screen.

I have tried by cleaning project flutter clean. But still it got stuck on splash screen. I have also used WidgetsFlutterBinding.ensureInitialized(); before executing the runApp(). Still it stuck on splash screen. Also haven't found error logs that can be resolved.

It is not happening with debug version or when I run with flutter run --release. The app is running smoothly in flutter run --release.

I'm using flutter 1.22.0 & VSCode 1.49.3. Testing & releasing for android.

I'm stuck with this last 3 days. It would be very helpful if anyone can help me.

Anirban Das
  • 1,035
  • 1
  • 18
  • 22

4 Answers4

13

Permanent solution

A permanent solution to @Anirban Das answer is to edit your release buildTypes on app/build.gradle with shrinkResources false as the following:

buildTypes {
    release {
        shrinkResources false
        minifyEnabled false
        signingConfig signingConfigs.release
    }
}
genericUser
  • 4,417
  • 1
  • 28
  • 73
  • 1
    I was using some Lottie files (from assets) on the splash screen (of flutter, not the native one). Adding only `shrinkResources false` helped me resolve this issue in my case. – Mahan Vyakti May 31 '21 at 17:58
  • I am facing a similar issue. This is happening with Flutter 2.2.3. I integrated a native SDK for ads after which the home screen stopped showing and the app is getting stuck on a black screen. Tried all of the above but none of them has helped resolve the issue – WeSay Solutions Jul 23 '21 at 16:12
  • I'm facing kind of same issue. but this problem is happening in my case when an app is not used for some days(approx a week). is it gonna solve the problem? or i have made some other mistake? – Safiul islam May 29 '23 at 09:35
9

I solved this problem by

flutter build apk --no-shrink --split-per-abi

Don't know why, but I think code default shrinking was the problem.

Anirban Das
  • 1,035
  • 1
  • 18
  • 22
1

Add android:allowBackup="false" tag inside your <application> object in your app manifest

Rajath
  • 92
  • 3
0

I used flutter_native_splash version 0.1.8 before and got the same issue, when i updated my flutter_native_splash version to 0.3.0 it works fine