Я продолжаю получать эту ошибку, когда пытаюсь запустить приложение-флаттер в Vscode. Я попытался запустить приложение по умолчанию и получит ту же ошибку. Я не уверен, что является причиной этого, поскольку я использовал другие проекты, и они работали нормально, но это кажется случайным.
Казалось бы, все в порядке, потом, когда я начал новый проект, эта ошибка начала появляться. Я попытался запустить старые проекты, и такая же ошибка происходит.
Полный вывод на консоль:
Launching lib\main.dart on SM J200Y in debug mode...
I/flutter (29160): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (29160): The following assertion was thrown building IconTheme(color: Color(0xdd000000)):
I/flutter (29160): Could not find a generator for route RouteSettings("/", null) in the _WidgetsAppState.
I/flutter (29160): Generators for routes are searched for in the following order:
I/flutter (29160): 1. For the "/" route, the "home" property, if non-null, is used.
I/flutter (29160): 2. Otherwise, the "routes" table is used, if it has an entry for the route.
I/flutter (29160): 3. Otherwise, onGenerateRoute is called. It should return a non-null value for any valid route not
I/flutter (29160): handled by "home" and "routes".
I/flutter (29160): 4. Finally if all else fails onUnknownRoute is called.
I/flutter (29160): Unfortunately, onUnknownRoute was not set.
I/flutter (29160): The relevant error-causing widget was:
I/flutter (29160): MaterialApp
[38;5;248mI/flutter (29160):[39;49m
I/flutter (29160): When the exception was thrown, this was the stack:
[38;5;244mI/flutter (29160): #0 _WidgetsAppState._onUnknownRoute.<anonymous closure>[39;49m
[38;5;244mI/flutter (29160): #1 _WidgetsAppState._onUnknownRoute[39;49m
[38;5;244mI/flutter (29160): #2 NavigatorState._routeNamed[39;49m
[38;5;244mI/flutter (29160): #3 NavigatorState.initState[39;49m
[38;5;244mI/flutter (29160): #4 StatefulElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #5 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #6 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #7 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #8 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #9 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #10 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #11 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #12 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #13 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #14 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #15 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #16 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #17 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #18 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #19 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #20 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #21 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #22 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #23 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #24 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #25 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #26 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #27 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #28 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #29 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #30 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #31 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #32 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #33 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #34 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #35 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #36 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #37 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #38 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #39 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #40 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #41 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #42 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #43 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #44 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #45 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #46 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #47 StatefulElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #48 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #49 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #50 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #51 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #52 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #53 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #54 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #55 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #56 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #57 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #58 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #59 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #60 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #61 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #62 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #63 SingleChildRenderObjectElement.mount[39;49m
[38;5;244mI/flutter (29160): #64 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #65 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #66 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #67 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #68 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #69 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #70 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #71 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #72 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #73 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #74 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #75 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #76 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #77 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #78 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #79 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #80 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #81 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #82 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #83 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #84 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #85 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #86 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #87 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #88 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #89 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #90 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #91 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #92 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #93 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #94 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #95 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #96 SingleChildRenderObjectElement.mount[39;49m
[38;5;244mI/flutter (29160): #97 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #98 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #99 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #100 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #101 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #102 StatefulElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #103 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #104 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #105 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #106 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #107 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #108 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #109 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #110 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #111 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #112 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #113 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #114 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #115 StatefulElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #116 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #117 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #118 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #119 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #120 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #121 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #122 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #123 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #124 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #125 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #126 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #127 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #128 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #129 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #130 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #131 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #132 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #133 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #134 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #135 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #136 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #137 SingleChildRenderObjectElement.mount[39;49m
[38;5;244mI/flutter (29160): #138 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #139 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #140 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #141 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #142 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #143 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #144 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #145 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #146 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #147 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #148 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #149 StatefulElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #150 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #151 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #152 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #153 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #154 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #155 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #156 StatefulElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #157 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #158 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #159 Element.updateChild[39;49m
'Padding\tetstst\android\' is not recognized as an internal or external command,
operable program or batch file.
[38;5;244mI/flutter (29160): #160 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #161 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #162 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #163 StatefulElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #164 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #165 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #166 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #167 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #168 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #169 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #170 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #171 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #172 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #173 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #174 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #175 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #176 StatefulElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #177 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #178 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #179 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #180 ComponentElement.performRebuild[39;49m
[38;5;244mI/flutter (29160): #181 Element.rebuild[39;49m
[38;5;244mI/flutter (29160): #182 ComponentElement._firstBuild[39;49m
[38;5;244mI/flutter (29160): #183 ComponentElement.mount[39;49m
[38;5;244mI/flutter (29160): #184 Element.inflateWidget[39;49m
[38;5;244mI/flutter (29160): #185 Element.updateChild[39;49m
[38;5;244mI/flutter (29160): #186 RenderObjectToWidgetElement._rebuild[39;49m
[38;5;244mI/flutter (29160): #187 RenderObjectToWidgetElement.mount[39;49m
[38;5;244mI/flutter (29160): #188 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>[39;49m
[38;5;244mI/flutter (29160): #189 BuildOwner.buildScope[39;49m
[38;5;244mI/flutter (29160): #190 RenderObjectToWidgetAdapter.attachToRenderTree[39;49m
[38;5;244mI/flutter (29160): #191 WidgetsBinding.attachRootWidget[39;49m
[38;5;244mI/flutter (29160): #192 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure>[39;49m
[38;5;244mI/flutter (29160): #201 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19)[39;49m
[38;5;244mI/flutter (29160): #202 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5)[39;49m
[38;5;244mI/flutter (29160): #203 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)[39;49m
I/flutter (29160): (elided 8 frames from package dart:async and package dart:async-patch)
I/flutter (29160): ════════════════════════════════════════════════════════════════════════════════════════════════════
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Код проекта:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home:Test(),
);
}
}
class Test extends StatelessWidget { // Hot restart will just retstart the widget, inside the stateless widget
@override
Widget build(BuildContext context) {
return Scaffold(
// Proptery with a vaule
appBar: AppBar(
backgroundColor: Colors.amber[600],
title: Text('My first app'),
centerTitle: true, // Centers app bar title
),
body: Center(// Everything below app bar, but centered in middle of screen
/* child: Icon( // adds icon
Icons.bluetooth,
color: Colors.blue,
size: 50.0,
), */
child: RaisedButton.icon( // adds button and icon together
onPressed: (){
print ("You pressed me");
},
icon: Icon(
Icons.mail
),
label: Text('Mail me'),
color: Colors.amber,
),
),
// outside of body
floatingActionButton: FloatingActionButton( // Defines button
onPressed: (){ // defines on pressed action
print('You clicked me');
},
child: Text('click'),
backgroundColor: Colors.blueAccent,
),
);
}
}```