Flutter 应用程序在发布模式下显示灰屏,但在调试模式下工作正常“DiagnosticsProperty<void>"实例 [英] Flutter app show grey screen in release mode but works fine in debug mode Instance of 'DiagnosticsProperty<void>'

查看:55
本文介绍了Flutter 应用程序在发布模式下显示灰屏,但在调试模式下工作正常“DiagnosticsProperty<void>"实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到该应用程序在调试模式下运行良好,但是当我在手机上尝试 apk 时,该应用程序在加载屏幕后显示灰色屏幕.当我使用 https 并添加所有权限时.

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 在发布模式下不工作(I/flutter (22182): 另一个异常被抛出:'fr' 的实例)

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

但在 flutter android 的调试模式下工作

but works in debug mode in flutter android

推荐答案

当您在调试模式下运行您的应用程序并且出现问题时,您会看到带有日志的可怕的红色错误屏幕.在发布模式下,您只会看到一个灰色的屏幕.

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.

对我来说是这样的:

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

我的应用在调试模式下完美运行,而 Flutter 仍然在后台抛出这个错误.

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

那么解决方案呢?

在调试模式下运行您的应用程序并检查日志,我相信您会在那里找到问题.只要您的代码中存在错误,更改 Flutter 频道就无济于事.

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.

这篇关于Flutter 应用程序在发布模式下显示灰屏,但在调试模式下工作正常“DiagnosticsProperty&lt;void&gt;"实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆