Flutter app show grey screen in release mode but works fine in debug mode Instance of 'DiagnosticsProperty<void>'
Asked Answered
C

6

66

I notice that the app works fine in debug mode but when I try the apk on my phone the app shows a grey screen after the loading screen. when i used https and i adding all permission.

Httpclient not works in release mode (I/flutter (22182): Another exception was thrown: Instance of 'fr')

but works in debug mode in flutter android

Chuipek answered 5/5, 2020 at 14:45 Comment(7)
Please provide more information to your question.Lotuseater
give me this in run (release mode). I/flutter (12736): Another exception was thrown: Instance of 'DiagnosticsProperty<void>'Chuipek
@Ahmed: Did you resolve this issue? I got same issueArachne
Also see this issue. Ours is with the camera module and we're trying to show a page to help the user take a selfie. In Release build it prints: Another exception was thrown: Instance of 'DiagnosticsProperty<void>'. We're seeing this on iOS but not Android.Margerymarget
Hi @Ahmed, could you tell me wich packages are you using in your app?Mediatize
I am also facing same issue when I try to open my app from firebase dynamic link. It opens the app but shows blank screen. Debugger is showing this error Instance of 'DiagnosticsProperty<void>'Chandra
I have this greying out problem as soon as try to write a message in Fluffychat for LinuxFloatage
G
78

When you run your app in debug mode and when something goes wrong, you see the scary red error screen with logs. In release mode, you just see a grey screen.

Now, when you ran your app in debug mode, at times there are some errors which are thrown but we mistakenly ignore them as we see the app is running perfectly on screen but if you open your logs in debug mode, you will see some error messages.

For me it was something like this:

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown while applying parent data.:
Incorrect use of ParentDataWidget.

The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject, which has been set up to accept ParentData of incompatible type StackParentData.

Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically, Expanded widgets are placed directly inside Flex widgets.
The offending Expanded is currently placed inside a Stack widget.

My app runs perfectly in debug mode while Flutter still throws this error in the background.

Now when I run the app in release mode, I see a grey screen which is different from my perfectly running app in debug mode.

When I checked the logs, I see the error message:

Flutter app show grey screen in release mode but works fine in debug mode Instance of 'DiagnosticsProperty<void>'

So the solution?

Run you app in debug mode and check logs, I am sure you will find the problem there. Changing Flutter channels won't help as long as there are errors in your code.

Graehl answered 25/6, 2020 at 12:12 Comment(13)
this is the solution for me! I relaunch in debug mode and fix all the issues, then finally works in release modeErratic
You are a savior man.....I wasted an entire day hunting for a solution and then I landed up to your answer. This did the trick for me.Pelagias
We all have been there @YuvrajPandeyGraehl
Is there, as far as you know, a way to force the error to be reproduced also in debug mode? Maybe with the red screen that pops out in other cases. @GraehlYam
Really. You are savior! Thank you so much!Buhler
For me there is no error in the debug mode, and in release one page is grayed (different behavior)Tacit
@Tacit I'd say check thoroughly. Some Widget rendering exception occurs especially when working with Columns and Stacks. There might be a grey warning instead of an error message in the logs. I have never faced the grey screen issue any other way.Graehl
@Graehl see here for more details about the issue, it is happening in Android Studio, but in VSCode I can see the error github.com/flutter/flutter/issues/92903Tacit
Is there a way we can make debug also render grey? So, it doesn't slip through.Nonpareil
I am afraid not @NonpareilGraehl
Where do you check the logs?Hereby
@Hereby The logs are the print statements that you see in the Terminal window. Add your own print() statements around the probable-error-causing widgets if you are not seeing any logs, although you should see the error message in debug mode in the Logs.Graehl
In my case running the app in release mode gave me the logs to catch the error.Hereby
H
13

In my case, I was using the Expanded widget inside Stack on one of my widgets.

Wrong Approach

Stack(
     children: [
          Expanded(child: buildHeader(context)),
          Align()
     ]),

Correct Approach

Stack(
     children: [
          buildHeader(context),
          Align()
     ]),

I was having this problem on both, android and iOS, platforms and this is how I resolved it.

Halitosis answered 10/9, 2021 at 12:53 Comment(3)
For me it happened only on web release builds. Expanded was the culprit, thank you!Itu
This was the solution for my caseMarley
for me it was the flexible widgetVoccola
H
3

first, you check AndroidManifest.xml (AndroidManifest.xml file for debug mode is different from AndroidManifest.xml file for release mode. check directory:

android\app\src\debug\AndroidManifest.xml

and directory:

android\app\src\main\AndroidManifest.xml

even you can create for release:

android\app\src\release\AndroidManifest.xml

try with add

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

to your target AndroidManifest.xml).

red screen in debug mode it's like grey screen in release mod that means you have an error code but for debug mode maybe this error be like warning and could run and you don't see any problem in your app in debug mode! but for release mode, you should fix it! like the case for me: I'm trying put Position Widget in Container Widget and I get this error :

Another exception was thrown: Instance of ‘DiagnosticsProperty’
Incorrect use of ParentDataWidget.

i fix it by change Container to Stack.

Hepatitis answered 25/8, 2020 at 6:50 Comment(1)
In my case it was a permission issue. +1 for that.Husbandry
F
0

This issue has been existed for a period of time, here is the related issue.

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 caused the grey screen. UI was working without grey screen even If I didn't handle properly until upgrading to 1.17.1 (previous flutter 1.12.13+hotfix.8), everything need to be more careful now.

Finkelstein answered 2/6, 2020 at 12:39 Comment(0)
C
0

I had a similar issue. After flutter upgrade, it works fine also in release mode.
These are my current versions:

  • Flutter 1.17.3 • channel stable • https://github.com/flutter/flutter.git
  • Framework • revision b041144f83 (8 days ago) • 2020-06-04 09:26:11 -0700
  • Engine • revision ee76268252
  • Tools • Dart 2.8.4
Cohlette answered 12/6, 2020 at 6:41 Comment(0)
S
0

My case i was using SfPdfViewer.file() inside of Expanded but the question is how it was working in debug but not in release. I just removed Expanded and it works for me.

Before

@override
  Widget build(BuildContext context) {
    print('File Path: ${widget.filePath}');
    return Scaffold(
      appBar: createAppBar('', false, showRightIcon: true,
          svgAsset: AppConstants.shareIcon,
          onRightIconPressed: () async {
            _shareFile();
          }),
      body: Expanded(
        child: SfPdfViewer.file(
          File(widget.filePath!),
          onDocumentLoaded: (details){
            // Get.snackbar('Alert', details.toString());
          },
          onDocumentLoadFailed: (details) {
            Get.snackbar('Alert', details.toString());
          },
        ),
      ),
    );
  }

After

@override
  Widget build(BuildContext context) {
    print('File Path: ${widget.filePath}');
    return Scaffold(
      appBar: createAppBar('', false, showRightIcon: true,
          svgAsset: AppConstants.shareIcon,
          onRightIconPressed: () async {
            _shareFile();
          }),
      body: SfPdfViewer.file(
        File(widget.filePath!),
        onDocumentLoaded: (details){
          // Get.snackbar('Alert', details.toString());
        },
        onDocumentLoadFailed: (details) {
          Get.snackbar('Alert', details.toString());
        },
      ),
    );
  }
Skyscraper answered 16/5, 2024 at 10:8 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.