Explain that a grey screen on release means an error and how to find the error
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!
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?
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
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.
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.
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:
...
You know the red error screen that you get when developing? When you build in release mode flutter replaces that with a gray screen.
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.
I am also facing this .Any solution
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.
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 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.
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 😕 .
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!
Triage: This looks like an uncaught Dart exception and not an engine crash. cc @Hixie for thoughts on better surfacing these errors.
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...
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.
Yeah, we should make this clearer in our docs for sure.
Allow us to register a default error widget that the framework uses in release?
That exists: https://master-api.flutter.dev/flutter/widgets/ErrorWidget/builder.html
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!"),
);
});
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