website icon indicating copy to clipboard operation
website copied to clipboard

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

Open pedro371 opened this issue 6 years ago • 47 comments

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!

pedro371 avatar Mar 28 '20 12:03 pedro371

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?

arteminthesky avatar Mar 28 '20 15:03 arteminthesky

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'

pedro371 avatar Mar 29 '20 10:03 pedro371

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.

MrAlek avatar Apr 07 '20 13:04 MrAlek

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:
  ...

jeroen-meijer avatar May 09 '20 22:05 jeroen-meijer

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

lukepighetti avatar May 10 '20 02:05 lukepighetti

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.

jeroen-meijer avatar May 10 '20 18:05 jeroen-meijer

I am also facing this .Any solution

jawad12345A avatar May 17 '20 17:05 jawad12345A

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.

HarryPratlett avatar May 27 '20 15:05 HarryPratlett

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 avatar Jun 01 '20 09:06 pgfeng

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.

pgfeng avatar Jun 01 '20 10:06 pgfeng

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 😕 .

Tokenyet avatar Jun 02 '20 12:06 Tokenyet

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!

vyalikvo2 avatar Jun 10 '20 13:06 vyalikvo2

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

chinmaygarde avatar Jun 12 '20 21:06 chinmaygarde

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...

Hixie avatar Jun 13 '20 23:06 Hixie

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.

jeroen-meijer avatar Jun 13 '20 23:06 jeroen-meijer

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

Hixie avatar Jun 13 '20 23:06 Hixie

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

lukepighetti avatar Jun 14 '20 12:06 lukepighetti

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

Hixie avatar Jun 19 '20 01:06 Hixie

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!"),
  );
});

lukepighetti avatar Jun 19 '20 01:06 lukepighetti

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

rrousselGit avatar Jul 12 '20 01:07 rrousselGit