最新消息:关注【已取消】微信公众号,可以获取全套资料,【全套Java基础27天】【JavaEE就业视频4个月】【Android就业视频4个月】

Flutter:Could not prepare to run the isolate错误

Flutter 太平洋学习网 浏览 评论

最近小编在开发flutter应用时出现了“Could not prepare to run the isolate”错误,具体错误内容如下:

D/FlutterActivityAndFragmentDelegate( 4887): No preferred FlutterEngine was provided.

Creating a new FlutterEngine for this FlutterFragment.

D/FlutterActivityAndFragmentDelegate( 4887): Attaching FlutterEngine to the Activity t

hat owns this Fragment.

D/FlutterView( 4887): Attaching to a FlutterEngine: io.flutter.embedding.engine.Flutte

rEngine@faa0146

D/FlutterActivityAndFragmentDelegate( 4887): Executing Dart entrypoint: main, and send

ing initial route: /

E/flutter ( 4887): [ERROR:flutter/shell/common/shell.cc(199)] Dart Error: error: impor

t of dart:mirrors is not supported in the current Dart runtime

E/flutter ( 4887): [ERROR:flutter/shell/common/engine.cc(198)] Could not prepare to ru

n the isolate.

E/flutter ( 4887): [ERROR:flutter/shell/common/engine.cc(137)] Engine not prepare and

launch isolate.

E/flutter ( 4887): [ERROR:flutter/shell/common/shell.cc(437)] Could not launch engine

with configuration.

解决方案:

小编也刚开始不知道“Could not prepare to run the isolate”的错误原因,最后排查,发现是“import”倒包的问题,也许是和系统有冲突,所以小编找了很久,将一个可疑的dart导包给去掉就好了,如下:

//import 'package:json_serializable/json_serializable.dart'; 
//注释掉可疑的package
//@JsonSerializableGenerator()
class News {
  final int id;
  String title;
  String author;
  String updateDate;
  String photourlOne;
  News(this.id, this.title, this.author, this.updateDate, this.photourlOne);

}

当然了,小编引入的json转换工具也有问题(主要是小编不会用),所以把pubspec.yaml里面的“json_serializable”包一并去掉了。

json_serializable: ^3.2.5

提示:

出现“Could not prepare to run the isolate”的问题基本都是导包的问题,可能是有冲突,也可能自己用错了,总之解决的重点是排查导包问题。

来源网站:太平洋学习网,转载请注明出处:http://www.tpyyes.com/a/flutter/977.html
"文章很值,打赏犒劳作者一下"
微信号: Javaweb_engineer

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

与本文相关的文章

发表我的评论
取消评论

表情

您的回复是我们的动力!

  • 昵称 (必填)

网友最新评论