'Flutter: White window after running flutter build APK release
**Flutter Project: When I check and run on the emulator everything works fine,
but when I make an apk and try to run it on my phone, it shows a white screen and it doesn’t start, but I was supposed to show a splash screen and get to the authorization page..
Has anyone encountered such a problem**
Flutter doctor:
[✓] Flutter (Channel unknown, 2.8.1, on macOS 12.3.1 21E258 darwin-arm, locale en-AC) • Flutter version 2.8.1 at /Users/sim/Development/flutter • Upstream repository unknown • Framework revision 77d935af4d (4 months ago), 2021-12-16 08:37:33 -0800 • Engine revision 890a5fca2e • Dart version 2.15.1
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/sim/Library/Android/sdk • Platform android-32, build-tools 32.1.0-rc1 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.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 11.0.11+0-b60-7772763)
Solution 1:[1]
Finally i found a solution
Changed build type: change buildTypes in android/app/build.gradle
buildTypes {
debug {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
signingConfig signingConfigs.release
minifyEnabled false
shrinkResources false
useProguard true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Solution 2:[2]
This problem usually occurs when there is a render flex issue. In device, we do not see any error(RED screen of error or black and yellow bars on the render flex side) while we run the debug build straight from Android Studio, but it will show a light grey screen when we run the release build in the device.
To solve the issue, you can check the console where you get to see the logs of the application. You will find an error causing the issue.
Solution 3:[3]
On my app, I have the same problem a few months ago.
A grey screen means there is some error.
Problem:
In my case, the problem was the expanded widget inside a stack widget. Expandeds() are only allowed in: Column(), Row(), or Flex() widgets.
Solution:
Just wrap each expanded widget (that are inside a stack widget) with a Column():
Column(
children: [
Expanded(
child: Container(...),
),
],
),
Hope it helps!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | S.A.R |
| Solution 2 | Preyansh Brahmbhatt |
| Solution 3 |
