When I try to build APK as the release version, I got a gray screen without nothing inside that in Flutter
the problem was because I used a Positioned widget inside some another Widget that makes a problem. after removing a Positioned widget in all screen that I used and build the app again everything works perfectly.in --release
mode we can't see any log but in debug
mode after I read all log I see I had to remove the Positioned widget. in --release
mode a gray screen is equal to red screen in debug
mode. but I have not any red screen in debug
mode in this happen make hard for me debugging
and here is a log that I saw in debug mode:
I/flutter (12822): The following assertion was thrown while applying parent data.:I/flutter (12822): Incorrect use of ParentDataWidget.I/flutter (12822): The ParentDataWidget Positioned wants to apply ParentData of type StackParentData to a RenderObject,I/flutter (12822): which has been set up to accept ParentData of incompatible type FlexParentData.I/flutter (12822): Usually, this means that the Positioned widget has the wrong ancestor RenderObjectWidget. Typically,I/flutter (12822): Positioned widgets are placed directly inside Stack widgets.I/flutter (12822): The offending Positioned is currently placed inside a Column widget.I/flutter (12822): The ownership chain for the RenderObject that received the incompatible parent data was:I/flutter (12822): Opacity ← ControlledAnimation<Map<String, dynamic>> ← FadeAnimation ← Positioned ← Column ←I/flutter (12822): Container ← _SingleChildViewport ← IgnorePointer-[GlobalKey#7bb01] ← Semantics ← _PointerListener ←I/flutter (12822): ⋯I/flutter (12822): I/flutter (12822): When the exception was thrown, this was the stack:I/flutter (12822): #0 RenderObjectElement._updateParentData.<anonymous closure> (package:flutter/src/widgets/framework.dart:5687:11)I/flutter (12822): #1 RenderObjectElement._updateParentData (package:flutter/src/widgets/framework.dart:5703:6)I/flutter (12822): #2 RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:5724:7)I/flutter (12822): #3 RenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5418:5)I/flutter (12822): #4 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5871:11)I/flutter (12822): ... Normal element mounting (21 frames)I/flutter (12822): #25 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3488:14)I/flutter (12822): #26 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5989:32)I/flutter (12822): ... Normal element mounting (115 frames)I/flutter (12822): #141 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3488:14)I/flutter (12822): #142 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5989:32)I/flutter (12822): ... Normal element mounting (191 frames)I/flutter (12822): #333 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3488:14)I/flutter (12822): #334 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5989:32)I/flutter (12822): ... Normal element mounting (360 frames)I/flutter (12822): #694 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3488:14)I/flutter (12822): #695 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5989:32)I/flutter (12822): ... Normal element mounting (240 frames)I/flutter (12822): #935 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3488:14)I/flutter (12822): #936 Element.updateChild (package:flutter/src/widgets/framework.dart:3256:18)I/flutter (12822): #937 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1132:16)I/flutter (12822): #938 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1103:5)I/flutter (12822): #939 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:1045:17)I/flutter (12822): #940 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2618:19)I/flutter (12822): #941 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1044:13)I/flutter (12822): #942 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:925:7)I/flutter (12822): #943 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:906:7)I/flutter (12822): (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)I/flutter (12822): ════════════════════════════════════════════════════════════════════════════════════════════════════