Flutter android release stuck on splash screen
Asked Answered
C

4

15

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.

Chrotoem answered 3/10, 2020 at 4:59 Comment(4)
try with the latest version of flutter and run flutter run --release -v to see the logs.Hypothermia
The app is not stucking on splash screen when running with flutter run --release. It is only stucking on splash screen in release apk...Chrotoem
are you fetching any data from the internet? IF yes, have you added the internet permission to the android manifest file?Chauchaucer
Internet permission is there in the manifest file....Chrotoem
C
11

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.

Chrotoem answered 3/10, 2020 at 18:5 Comment(1)
This did not work for me, I had to downgrade to gradle 6.1.1 and buildtool 4.0.2Trencherman
I
16

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
    }
}
Incorporation answered 9/4, 2021 at 18:32 Comment(4)
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.Leman
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 issueMogilev
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?Ramonramona
Similar issue, and your solution worked for us. Could you help me understand why?Middleoftheroader
C
11

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.

Chrotoem answered 3/10, 2020 at 18:5 Comment(1)
This did not work for me, I had to downgrade to gradle 6.1.1 and buildtool 4.0.2Trencherman
T
1

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

Tontine answered 22/12, 2022 at 6:33 Comment(0)
C
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

Could answered 26/8, 2021 at 7:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.