Flutter编译构建异常

时间:2019-01-23 10:32:04

标签: dart flutter

我的“ hello world”颤动应用程序运行时会产生一个编译时异常,但我不知道为什么,您能帮忙吗?

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
I/Choreographer(11667): Skipped 38 frames!  The application may be doing too much work on its main thread.
D/EGL_emulation(11667): eglMakeCurrent: 0x9fe05840: ver 3 0 (tinfo 0x9fe038e0)
Syncing files to device Android SDK built for x86...
I/flutter (11667): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (11667): The following _CompileTimeError was thrown building WidgetsApp-[GlobalObjectKey
I/flutter (11667): _MaterialAppState#bcca2](dirty, state: _WidgetsAppState#2be90):
I/flutter (11667): 'package:flutter/src/widgets/app.dart': error: line 1129 pos 21:
I/flutter (11667): file:///D:/Flutter/flutter/packages/flutter/lib/src/widgets/app.dart:1129:21: Error: Too few
I/flutter (11667): positional arguments: 1 required, 0 given.
I/flutter (11667):       result = Stack(
I/flutter (11667):                     ^
I/flutter (11667):       result = Stack(
I/flutter (11667):                     ^
I/flutter (11667): 
I/flutter (11667): When the exception was thrown, this was the stack:
I/flutter (11667): #0      StatefulElement.build (package:flutter/src/widgets/framework.dart:3809:27)
I/flutter (11667): #1      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3721:15)
I/flutter (11667): #2      Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #3      ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #4      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3848:11)
I/flutter (11667): #5      ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #6      Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #7      Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #8      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #9      Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #10     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #11     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #12     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #13     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #14     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #15     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #16     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #17     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #18     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #19     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #20     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #21     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #22     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #23     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #24     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #25     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #26     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #27     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #28     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #29     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3848:11)
I/flutter (11667): #30     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #31     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #32     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #33     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #34     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #35     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #36     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #37     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #38     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #39     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
I/flutter (11667): #40     Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
I/flutter (11667): #41     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
I/flutter (11667): #42     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3848:11)
I/flutter (11667): #43     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
I/flutter (11667): #44     Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
I/flutter (11667): #45     Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
I/flutter (11667): #46     RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:909:16)
I/flutter (11667): #47     RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:880:5)
I/flutter (11667): #48     RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:826:17)
I/flutter (11667): #49     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2266:19)
I/flutter (11667): #50     RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:825:13)
I/flutter (11667): #51     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:712:7)
I/flutter (11667): #52     runApp (package:flutter/src/widgets/binding.dart:756:7)
I/flutter (11667): #53     main (package:new_flutter_app_demo/main.dart:4:3)
I/flutter (11667): #54     _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:289:19)
I/flutter (11667): #55     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I/flutter (11667): ════════════════════════════════════════════════════════════════════════════════════════════════════
D/        (11667): HostConnection::get() New Host Connection established 0x8bae6140, tid 11694
D/EGL_emulation(11667): eglMakeCurrent: 0xa7a652e0: ver 3 0 (tinfo 0x9fb09ac0)

2 个答案:

答案 0 :(得分:0)

对不起,请稍后回答。请删除flutter sdk,然后重新安装flutter sdk,即可完成工作。

答案 1 :(得分:0)

在Flutter安装目录中执行以下命令应将其修复

git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor