Flutter Could not prepare to run the isolate

馋奶兔 提交于 2020-03-22 03:58:52

问题


I started a flutter project using Android studio. The android emulator opened the project smoothly. When I opened the Ios emulator, the project worked smoothly. When I ran the android emulator again, project isn't runed . Thanks for your help.

Android Studio Features :

  • Android Studio 3.0
  • Build #AI-171.4408382, built on October 20, 2017
  • JRE: 1.8.0_152-release-915-b08 x86_64
  • JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
  • Mac OS X 10.12.6

Flutter : v0.4.4 Beta

Console :

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...
Built build/app/outputs/apk/debug/app-debug.apk.
I/FlutterActivityDelegate( 2747): onResume setting current activity to this
E/flutter ( 2747): [ERROR:flutter/shell/common/engine.cc(147)] Could not prepare to run the isolate.
E/flutter ( 2747): [ERROR:flutter/shell/common/engine.cc(112)] Engine not prepare and launch isolate.
E/flutter ( 2747): [ERROR:flutter/shell/platform/android/android_shell_holder.cc(138)] Could not launch engine in configuration.
Syncing files to device Android SDK built for x86...
Application finished.

回答1:


I had the same error and it happened when I didn't write the main method. so do this

void main() => runApp(MyApp());

MyApp is my main class




回答2:


  1. please check whether your Flutter Project containsmain.dart in lib folder, if not, create it.

  2. check your code like this:

import 'package:flutter/material.dart';
import 'package:module_flutter/xxxApp.dart';

void main() => runApp( new xxxApp());



回答3:


Make sure you'r app is not running multiple instances. Try to stop them all first.




回答4:


I have the same error. I tried many ways and this is the right way.

You need to run

flutter build ios --debug (or --profile or --release)

before you launch the project in Xcode.



来源:https://stackoverflow.com/questions/50654820/flutter-could-not-prepare-to-run-the-isolate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!