Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain that a grey screen on release means an error and how to find the error #7773

Open
pedro371 opened this issue Mar 28, 2020 · 47 comments
Labels
dev.debugging Relates to debugging Flutter apps dev.deployment Relates to deploying Flutter app section of Flutter.dev e2-days Effort: < 5 days from.flutter-sdk Reported via move from flutter/flutter p3-low Valid but not urgent concern. Resolve when possible. Encourage upvote to surface. st.triage.ltw Indicates Lead Tech Writer has triaged t.framework Relates to Flutter framework

Comments

@pedro371
Copy link

pedro371 commented Mar 28, 2020

Hello guys,

I have made an App which works on the simulator and also on my iPhone (connected with a cable) but when I upload the app via Xcode to appstoreconnect and install the app via TestFlight is the screen grey.

I have made this experience with 2 Flutter apps.

App 1:

App 2:

Flutter doctor -v: 

[✓] Flutter (Channel dev, v1.16.3, on Mac OS X 10.15.3 19D76, locale
    de-DE)
    • Flutter version 1.16.3 at
      /Users/pp/Documents/workspace/flutter
    • Framework revision be3a4b37b3 (2 days ago), 2020-03-26 18:08:05
      -0700
    • Engine revision b2bdeb3f0f
    • Dart version 2.8.0 (build 2.8.0-dev.17.0 1402e8e1a4)

 
[✓] Android toolchain - develop for Android devices (Android SDK version
    28.0.3)
    • Android SDK at /Users/pp/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native
      profiling support)
    • Platform android-29, build-tools 28.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.4

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google
      Chrome

[✓] Android Studio (version 3.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 31.3.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1136-b06)

[✓] VS Code (version 1.43.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.8.1

 
[✓] Connected device (2 available)            
    • Chrome     • chrome     • web-javascript • Google Chrome
      80.0.3987.149
    • Web Server • web-server • web-javascript • Flutter Tools

• No issues found!
@arteminthesky
Copy link

It looks like you are catching an error right at the start. Have you tried running the release build through the IDE on your physical device?

@pedro371
Copy link
Author

It looks like you are catching an error right at the start. Have you tried running the release build through the IDE on your physical device?

I created in Xcode a new Schema with the build configuration release. Now I'm getting this error:

2020-03-29 12:47:02.611007+0200 Runner[537:47758] Metal API Validation Enabled
2020-03-29 12:47:03.302405+0200 Runner[537:47995] flutter:
2020-03-29 12:47:03.302875+0200 Runner[537:47995] flutter: Another exception was thrown: Instance of 'DiagnosticsProperty'

@MrAlek
Copy link

MrAlek commented Apr 7, 2020

I started getting the exact same behavior on Android today. Running locally on device is fine but building a signed bundle or apk from Android Studio produces a grey screen on launch.

What's even weirder is that all my bundles were working until noon today when suddenly all newly generated bundles got this on startup. Tried both on v1.12.13+hotfix.8 and hotfix.9 and have zero code changes. This leads me to believe it's an IDE issue but I haven't been able to pinpoint it.

@TahaTesser TahaTesser added t.framework Relates to Flutter framework and removed t.framework Relates to Flutter framework labels Apr 9, 2020
@jeroen-meijer
Copy link

jeroen-meijer commented May 9, 2020

Update: solved for me.

Check out @lukepighetti's comment below. Turns out it was an issue on my side.

Original comment

Anyone who also experiences this (like me), don't forget to add a +1 (👍) on the top comment.

This is the metric the Flutter team uses to prioritize problems/issues.


If it helps, here is a full verbose device log of this happening on Android (app ID is dev.jfk.jasje_leggen). It also happens on iOS.

Important note: This issue only happens if I install a release version on a device that didn't have the app installed. If I install debug first, followed by a release build, it works fine.
I've also seen the app work the first couple of launches, and then it starts showing the grey screen every time after that.

Happens on both stable and beta channels (1.17.0), either compiling locally or through Codemagic CI.

flutter doctor -v output.

pubspec.yaml metadata and dependencies:

name: "jasje_leggen"
description: "Een app voor het bijhouden van scores tijdens klaverjassen."
publish_to: "none"
version: "0.0.3+3"
environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  animations: ^1.0.0+5
  cupertino_icons: "^0.1.3"
  flutter_svg: ^0.17.4
  font_awesome_flutter: "^8.8.1"
  freezed_annotation: "^0.7.1"
  get_it: ^4.0.2
  numberpicker: ^1.2.0
  package_info: ^0.4.0+17
  rxdart: "^0.24.0"
  state_persistence: "^0.0.7"
  time: "^1.3.0"

dev_dependencies:
  ...

@lukepighetti
Copy link
Contributor

You know the red error screen that you get when developing? When you build in release mode flutter replaces that with a gray screen.

@jeroen-meijer
Copy link

Thank you @lukepighetti.
As others pointed out to me, the grey screen others and I have observed indicates an error that happened in release mode. I was able to track it down and fix it.

@jawad12345A
Copy link

I am also facing this .Any solution

@HarryPratlett
Copy link

HarryPratlett commented May 27, 2020

I'm getting this problem, but only when the code is run externally on a webpage of mine. When the release build is run locally, no issue occurs. However, when run on the website, grey screens are produced for parts of the application. How would I go about identifying the issues, since I am not getting any console issues in the chrome developer tools?

EDIT: My issue seemed to be with HTTPS, when I dropped the site to HTTP it was functional.

@pgfeng
Copy link

pgfeng commented Jun 1, 2020

I have the same problem, It happens when I try to generate a release.

flutter run --release

I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'

@pgfeng
Copy link

pgfeng commented Jun 1, 2020

I have the same problem, It happens when I try to generate a release.

flutter run --release

I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'
I/flutter (17345): Another exception was thrown: Instance of 'DiagnosticsProperty'

You know the red error screen that you get when developing? When you build in release mode flutter replaces that with a gray screen.

I went back to debug mode once and found the red error message, thank you.

@Tokenyet
Copy link

Tokenyet commented Jun 2, 2020

I've come across this issue, but this depends on the code. For me, with CacheNetworkImage issue#404, I passed wrong imageUrl or null, that cause the grey screen. UI was working without grey screen even If I didn't handle properly until upgrading to 1.17.1, everything need to be more careful 😕 .

@vyalikvo2
Copy link

vyalikvo2 commented Jun 10, 2020

It's a Flutter crash.

I had the same issue and solved it by installing SENTRY error logging in my flutter project.
It takes me for 30 minutes for installing and fixing :)

Here is a link to flutter official documentation about SENTRY:
https://flutter.dev/docs/cookbook/maintenance/error-reporting

P.S.
Also watch carefully for imports while installing, because you can have dart:html error.
see:
https://stackoverflow.com/questions/61484592/flutter-build-cannot-find-darthtml

P.P.S
Make sure your app have access to the internet in AndroidManifest.xml if you installing SENTRY

<manifest xlmns:android...>
 ...
 <uses-permission android:name="android.permission.INTERNET" />
 <application ...
</manifest>

Good luck!

@chinmaygarde
Copy link
Member

Triage: This looks like an uncaught Dart exception and not an engine crash. cc @Hixie for thoughts on better surfacing these errors.

@Hixie
Copy link
Contributor

Hixie commented Jun 13, 2020

Yeah, this is working as intended. Not sure exactly what we can do to make it better. When we had it show an error message, people complained that we were showing error messages to their users...

@jeroen-meijer
Copy link

I completely understand. I can't think of anything better either.

Perhaps adding something to the FAQ or official docs explaining the grey parts will make people realize the fact they have an issue in their app sooner.

@Hixie
Copy link
Contributor

Hixie commented Jun 13, 2020

Yeah, we should make this clearer in our docs for sure.

@Hixie Hixie added d: website - content t.framework Relates to Flutter framework labels Jun 13, 2020
@Hixie Hixie changed the title Grey screen on release Explain that a grey screen on release is indicative of an error (and how to find the error) Jun 13, 2020
@lukepighetti
Copy link
Contributor

Allow us to register a default error widget that the framework uses in release?

@Hixie
Copy link
Contributor

Hixie commented Jun 19, 2020

That exists: https://master-api.flutter.dev/flutter/widgets/ErrorWidget/builder.html

@lukepighetti
Copy link
Contributor

lukepighetti commented Jun 19, 2020

Wow! Cool! Thanks so much for the link.

It looks like you can override it like this?

ErrorWidget.builder = ((e) {
  return Center(
    child: Text("There was an error!"),
  );
});

@rrousselGit
Copy link
Contributor

I faced this issue when building on Flutter web

What's surprising is: When reading the dev console, there are no errors.
I would expect the default behavior on web to do a console.error

@sfshaza2
Copy link
Contributor

This issue looks like it can be moved to the website repo. Yes, @Hixie?

@jeroen-meijer
Copy link

jeroen-meijer commented Jul 15, 2020

I disagree @sfshaza2.
This issue affects all apps built with Flutter, regardless of the platform.

I believe the docs should be clearer about the reason and situations in which a grey screen may appear. I think it'd be great if the docs also included a side-note that the ErrorWidget can be replaced (as pointed out by @lukepighetti) 👍

@jagadish-pattanaik
Copy link

jagadish-pattanaik commented Nov 22, 2020

I am also getting the same grey screen on start just after the splash screen...is the error at the start or it can be anywhere in the app? Does assertions also cause this grey screen? Or only error?

its shoes like this

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

@hntan
Copy link

hntan commented Nov 25, 2020

With the help of ErrorWidget, now I can see the error message on the screen (No Firebase App '[DEFAULT]' has been created). That's because of the missing await before Firebase.initializeApp()

void main() async {
   WidgetsFlutterBinding.ensureInitialized();
   await Firebase.initializeApp(); // <--- need to add the await before
   runApp(MyApp());
}

@jagadish-pattanaik
Copy link

@hntan I am also using Firebase.initializeApp(); and getting the following error, I think it's because of that only. And that is only in release mode. Does adding await solve the following error?

I found it in log cat what was the error:-

ConnectionTracker: Exception thrown while unbinding java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.measurement.internal.zzjp@6b0fcf at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1757) at android.app.ContextImpl.unbindService(ContextImpl.java:1874) at android.content.ContextWrapper.unbindService(ContextWrapper.java:792) at com.google.android.gms.common.stats.ConnectionTracker.zza(com.google.android.gms:play-services-basement@@17.3.0:55) at com.google.android.gms.common.stats.ConnectionTracker.unbindService(com.google.android.gms:play-services-basement@@17.3.0:50) at com.google.android.gms.measurement.internal.zziv.zzag(com.google.android.gms:play-services-measurement-impl@@17.5.0:245) at com.google.android.gms.measurement.internal.zziv.zzal(com.google.android.gms:play-services-measurement-impl@@17.5.0:262) at com.google.android.gms.measurement.internal.zziv.zzc(com.google.android.gms:play-services-measurement-impl@@17.5.0:336) at com.google.android.gms.measurement.internal.zziu.zza(com.google.android.gms:play-services-measurement-impl@@17.5.0:2) at com.google.android.gms.measurement.internal.zzai.run(com.google.android.gms:play-services-measurement-impl@@17.5.0:7) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at com.google.android.gms.measurement.internal.zzfy.run(com.google.android.gms:play-services-measurement-impl@@17.5.0:21)

How to solve this?

@hntan
Copy link

hntan commented Nov 26, 2020

@hntan I am also using Firebase.initializeApp(); and getting the following error, I think it's because of that only. And that is only in release mode. Does adding await solve the following error?

I found it in log cat what was the error:-

ConnectionTracker: Exception thrown while unbinding java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.measurement.internal.zzjp@6b0fcf at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1757) at android.app.ContextImpl.unbindService(ContextImpl.java:1874) at android.content.ContextWrapper.unbindService(ContextWrapper.java:792) at com.google.android.gms.common.stats.ConnectionTracker.zza(com.google.android.gms:play-services-basement@@17.3.0:55) at com.google.android.gms.common.stats.ConnectionTracker.unbindService(com.google.android.gms:play-services-basement@@17.3.0:50) at com.google.android.gms.measurement.internal.zziv.zzag(com.google.android.gms:play-services-measurement-impl@@17.5.0:245) at com.google.android.gms.measurement.internal.zziv.zzal(com.google.android.gms:play-services-measurement-impl@@17.5.0:262) at com.google.android.gms.measurement.internal.zziv.zzc(com.google.android.gms:play-services-measurement-impl@@17.5.0:336) at com.google.android.gms.measurement.internal.zziu.zza(com.google.android.gms:play-services-measurement-impl@@17.5.0:2) at com.google.android.gms.measurement.internal.zzai.run(com.google.android.gms:play-services-measurement-impl@@17.5.0:7) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at com.google.android.gms.measurement.internal.zzfy.run(com.google.android.gms:play-services-measurement-impl@@17.5.0:21)

How to solve this?

@jagadish-pattanaik Yes I think, so either adding the await before Firebase.initializeApp() or put it into the FutureBuilder widget. You can also see more detail here https://stackoverflow.com/questions/63492211/no-firebase-app-default-has-been-created-call-firebase-initializeapp-in/63492262#63492262

@jagadish-pattanaik
Copy link

With the help of ErrorWidget, now I can see the error message on the screen (No Firebase App '[DEFAULT]' has been created). That's because of the missing await before Firebase.initializeApp()

void main() async {
   WidgetsFlutterBinding.ensureInitialized();
   await Firebase.initializeApp(); // <--- need to add the await before
   runApp(MyApp());
}

Thanks broo....it worked for me....you saved me man...I was trying from 5 days

@srihariash999
Copy link

@hntan I am also using Firebase.initializeApp(); and getting the following error, I think it's because of that only. And that is only in release mode. Does adding await solve the following error?
I found it in log cat what was the error:-
ConnectionTracker: Exception thrown while unbinding java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.measurement.internal.zzjp@6b0fcf at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1757) at android.app.ContextImpl.unbindService(ContextImpl.java:1874) at android.content.ContextWrapper.unbindService(ContextWrapper.java:792) at com.google.android.gms.common.stats.ConnectionTracker.zza(com.google.android.gms:play-services-basement@@17.3.0:55) at com.google.android.gms.common.stats.ConnectionTracker.unbindService(com.google.android.gms:play-services-basement@@17.3.0:50) at com.google.android.gms.measurement.internal.zziv.zzag(com.google.android.gms:play-services-measurement-impl@@17.5.0:245) at com.google.android.gms.measurement.internal.zziv.zzal(com.google.android.gms:play-services-measurement-impl@@17.5.0:262) at com.google.android.gms.measurement.internal.zziv.zzc(com.google.android.gms:play-services-measurement-impl@@17.5.0:336) at com.google.android.gms.measurement.internal.zziu.zza(com.google.android.gms:play-services-measurement-impl@@17.5.0:2) at com.google.android.gms.measurement.internal.zzai.run(com.google.android.gms:play-services-measurement-impl@@17.5.0:7) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at com.google.android.gms.measurement.internal.zzfy.run(com.google.android.gms:play-services-measurement-impl@@17.5.0:21)
How to solve this?

@jagadish-pattanaik Yes I think, so either adding the await before Firebase.initializeApp() or put it into the FutureBuilder widget. You can also see more detail here https://stackoverflow.com/questions/63492211/no-firebase-app-default-has-been-created-call-firebase-initializeapp-in/63492262#63492262

Thank you very much, I couldn't catch this error with the error widget or otherwise. Saved the day !

@anuj9665
Copy link

I Just replaced the removed Expanded widget and it solved my problem. There might be some widget causing the problem.

@AhmedKhattab95
Copy link

it;s also happen when user deny storage/location permission in android from device settings

@goderbauer goderbauer added the P4 label Sep 20, 2022
@atsansone atsansone transferred this issue from flutter/flutter Nov 11, 2022
@atsansone atsansone added from.flutter-sdk Reported via move from flutter/flutter and removed documentation labels Nov 11, 2022
@Naaidrv
Copy link

Naaidrv commented Nov 11, 2022

What widgets are you using?
If you are using the "stack" widget sometimes causes that gray screen, I recommend you to change it or remove it.
Good luck! :D

@raj457036
Copy link

raj457036 commented Mar 27, 2023

We are also experiencing the same thing but logging in release mode is a bit no-no for us.

For local crash recording you can use flutter_pipeline.

flutter_pipeline can record crashes locally for easy debugging in release mode.

Good Day!

@atsansone atsansone added dev.deployment Relates to deploying Flutter app section of Flutter.dev dev.debugging Relates to debugging Flutter apps p3-low Valid but not urgent concern. Resolve when possible. Encourage upvote to surface. and removed P4 labels Jun 1, 2023
@atsansone atsansone changed the title Explain that a grey screen on release is indicative of an error (and how to find the error) Explain that a grey screen on release means an error and how to find the error Jun 5, 2023
@atsansone atsansone added e2-days Effort: < 5 days st.triage.ltw Indicates Lead Tech Writer has triaged labels Jun 5, 2023
@mazud21
Copy link

mazud21 commented Sep 8, 2023

You know the red error screen that you get when developing? When you build in release mode flutter replaces that with a gray screen.

I'll noted it, thanks @lukepighetti

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev.debugging Relates to debugging Flutter apps dev.deployment Relates to deploying Flutter app section of Flutter.dev e2-days Effort: < 5 days from.flutter-sdk Reported via move from flutter/flutter p3-low Valid but not urgent concern. Resolve when possible. Encourage upvote to surface. st.triage.ltw Indicates Lead Tech Writer has triaged t.framework Relates to Flutter framework
Projects
None yet
Development

No branches or pull requests