Flutter android grey screen in release mode even if there are no errors or red screens in debug mode
Solution 1
Nothing worked for me as there was no error in the UI. The error was at the beginning of the app in the main. After adding await
before Firebase.initializeApp();
worked like miracle.
void main() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: Colors.transparent));
**await** Firebase.initializeApp(); //adding await solved the problem
SharedPreferences.getInstance().then((prefs) {
var brightness = SchedulerBinding.instance.window.platformBrightness;
if (brightness == Brightness.dark) {
prefs.setBool('darkMode', true);
} else {}
var darkModeOn = prefs.getBool('darkMode') ?? false;
runApp(
ChangeNotifierProvider<ThemeNotifier>(
create: (_) => ThemeNotifier(darkModeOn ? darkTheme : lightTheme),
child: MaterialApp(
home: root(),
),
),
);
});
}
Solution 2
Sometime it works well in debug mode but not working in release mode. You may catch that error by running below command in your terminal.
flutter run --release
The command compiles to release mode. When grey screen happened, you can check your debug console.
Jagadish
I develop cross-platform apps and websites. I have developed 3 android apps and published them on the Play Store, one of them is Just Meet with thousands of daily users. I have been coding from class 8 and have gained 3 years of experience with flutter language and android app development. I am a student of class 10 presently, I study all day and code at night. I believe in developing free or low-cost high-quality premium apps available to all the people of India. Recently I developed Just Meet, a video conferencing app that gives complete privacy, is secured and end to end encrypted, uses lesser data and battery, and works well in bad network areas like a charm and the best thing is it has no restriction on the number of participants or meeting duration and that too completely free! As I code alone it took me about 3 months to complete the initial release of it. It has a lot of features, some are new and very helpful. I believe this app will help a lot of people save their money and continue their meetings even in the worst network peacefully without having the tension of their user data! I have experience working on Firebase, Adsense, Admob, Facebook Audience Network, Unity Ads, etc, and also little in Python, Java, JavaScript, HTML, CSS, AIML. When am not studying and frustrated with bugs and errors usually spend my time working out on my muscles, painting, and playing with my pet dog "Ani".
Updated on December 25, 2022Comments
-
Jagadish over 1 year
I am getting grey screen on startup just after the splash screen on android real device. I have solved all errors or red screens and after that tried again but still it remains the same.
Note: I have released 2 versions of this app before this one to play store. So this is not the first one.
My log
Flutter run key commands. h Repeat this help message. c Clear the screen q Quit (terminate the application on the device). I/flutter (24661): <-- stops here nothing after this
-
sameer kashyap over 3 yearsa grey screen most probably indicates a UI error such as null pointer exception. Could you post the code for which screen its showing grey?
-
Jagadish over 3 yearsok then its a ui error not a function error right?? As i have solved all function errors. Post the code...its showing at the start just after the splash screen i dont know for which page the problem has occurred.
-
Jagadish over 3 yearsIs the problem at the starting page or it can be anywhere in the app? i asked this because its showing at the start just after the splash screen?
-
Jagadish over 3 years@sameer kashyap I have editted the question...i hav added tht how app behaves in one of my phone in debug mode...it just gets stuck at installling... and tells signature diesnt matches in release mode but o another hone it shows grey screen in release mode and debug works fine.
-
sameer kashyap over 3 yearsThen it Most probably in one of the widgets that's shown early on, have you tried debug mode again? it should certainly show up.
-
sameer kashyap over 3 yearsis the data shown on the device consistent? Like if there's a empty field in your database for one of the user accounts, which is being accessed in the UI, it might cause.
-
Jagadish over 3 yearsNo i tried the dubg mode and visited evry page of my app and there was no error or red screen. And about the null data then i have solved it already by giving initial values. When i ran in release mode i got grey screen again.
-
Jagadish over 3 yearsThe log-> Running Gradle task 'assembleRelease'... Running Gradle task 'assembleRelease'... Done 692.3s (!) √ Built build\app\outputs\flutter-apk\app-release.apk (51.7MB). Installing build\app\outputs\flutter-apk\app.apk... 10.3s Flutter run key commands. h Repeat this help message. c Clear the screen q Quit (terminate the application on the device). I/flutter (17690): <- stopped here
-
Jagadish over 3 years@sameerkashyap please invite others and your friends too...to help me please...so that it will be easy to track down the problem.
-
Jagadish over 3 yearsthe grey screen only related to my code error or it can be plugin error and build error or some android error????
-
Abhijith over 3 yearscheck your terminal for
Incorrect usage of Parent Widget
,the grey screen is a design issue it will work on debug mode,not release mode@Jagadish -
Jagadish over 3 yearsin debug mode no error is shown in the terminal... but after that also can aa error still exist?
-
Ali Qanbari over 3 yearsI had a similar issue. in my case, it was caused by not requesting device permissions correctly. check your permission code and only request permissions when it is not already granted.
-
-
Jagadish over 3 yearsI am doing that only...it's shoeing grey screen and in debug console nothing shows up...please read my question again.?.I need help...
-
John Joe over 3 years
I/flutter (17690): <- stopped here
. It seems like you have useprint
to print out something? Did you use the above command to run it as release mode? -
Jagadish over 3 yearsNo I haven't used print....the log stops there and yes I have used the command to run
-
Jagadish over 3 years@sameer kashyap , @aligator , and @Assassin please help the log reader stops at
I/flutter (17690):
but it should show ` I/flutter (17690): completed or other things after that` i am afraid that its not a UI error maybe its some android build error or anything else please help me out.... -
John Joe over 3 yearsbut it should show ` I/flutter (17690): completed or other things after that`.. Why would you expect it will show this? Please post the relevant code
-
Jagadish over 3 years.....Because sometimes it woks automatically and then in the log it shoes all things like in debug mode but when it doesn't it gets stuck there. And more surprising is thats ten if there are no changes in code sometimes it works and sometimes it shoes grey screen.
-
John Joe over 3 yearsthe grey screen normally stuck at which page? do you use any
async-await
on that page? -
Jagadish over 3 yearsThe grey screen shoes just after thae splash screen...yes I use async and await on that page
-
Jagadish over 3 yearsActually I use a root page which decides either she duser to login page or main page...I use shared preference to get that user has signed in or not and then return the page.
-
John Joe over 3 yearsso the grey screen appear when first time sign in? Did you still get grey screen when open the app second time?
-
Jagadish over 3 yearsNo it appears every time...when the app starts just after the splash screen but sometimes it does work on its own and the app works then after wards without any change also it doesn't work...should I make a repository of my code on GitHub ?
-
Jagadish over 3 yearsthe grey screen just after indicates error at the beggining or the error can be anywhere in the app??
-
Jagadish over 3 yearsOk sure let me create a private repository only for teams and include you in it...you can also add your friends you know who can help...and yes thanks a lot for helping me in advance!!!
-
Jagadish over 3 yearsdoes call
Firebase.initializeApp();
in main cause the problem or the grey screen can only be for UI? -
Jagadish over 3 yearsLet us continue this discussion in chat.