简体   繁体   English

存在模拟器时 Flutter 应用程序未运行

[英]Flutter app not running when emulator is present

The emulators are there but when I launch the app it doesn't work, please help:)模拟器在那里但是当我启动应用程序时它不起作用,请帮助:)

I have tried everything.我已经尝试了一切。

Cal, Flutter newbie. Cal,Flutter 新手。

I have followed the installation guidelines and tried fixes from other stack flow answers i am running windows 8.1 singular user.我已遵循安装指南并尝试从其他堆栈流答案中修复我正在运行 Windows 8.1 单一用户。 i have tried from command prompt and in the android terminal我已经从命令提示符和 android 终端中尝试过

<***C:\Users\Callum\first_app> Flutter emulators <***C:\Users\Callum\first_app> Flutter 模拟器

2 available emulators: 2 个可用的模拟器:

Pixel_2_API_27 • pixel_2 • Google • Pixel 2 API 27 Pixel_2_API_27 • pixel_2 • Google • Pixel 2 API 27

Pixel_2_API_28 • pixel_2 • Google • Pixel 2 API 28 Pixel_2_API_28 • pixel_2 • Google • Pixel 2 API 28

To run an emulator, run 'flutter emulators --launch '.要运行模拟器,请运行“flutter emulators --launch”。

To create a new emulator, run 'flutter emulators --create [--name xyz]'.要创建新的模拟器,请运行“flutter emulators --create [--name xyz]”。

You can find more information on managing emulators at the links below:您可以在以下链接中找到有关管理模拟器的更多信息:

https://developer.android.com/studio/run/managing-avds https://developer.android.com/studio/run/managing-avds

https://developer.android.com/studio/command-line/avdmanagerhttps://developer.android.com/studio/command-line/avdmanager

C:\Users\Callum\first_app> Flutter emulators --launch Pixel_2_API_28 C:\Users\Callum\first_app> Flutter 模拟器 --launch Pixel_2_API_28

//emulator launches //模拟器启动

C:\Users\Callum\first_app> Flutter run C:\Users\Callum\first_app> Flutter 运行

No connected devices.没有连接的设备。

C:\Users\Callum\first_app>***> C:\Users\Callum\first_app>***>

I want the flutter app to run我想让 flutter 应用程序运行

UPDATE更新

C:\Users\Callum\first_app> flutter doctor -v C:\Users\Callum\first_app> flutter doctor -v

[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 6.3.9600], locale en-US) [√] Flutter(频道稳定,v1.2.1,在 Microsoft Windows [版本 6.3.9600] 上,语言环境 en-US)

• Flutter version 1.2.1 at C:\src\flutter\flutter • Flutter 版本 1.2.1 位于 C:\src\flutter\flutter

 • Framework revision 8661d8aecd (3 months ago), 2019-02-14 19:19:53 -0800 • Engine revision 3757390fa4 • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[√] Android toolchain - develop for Android devices (Android SDK version [√] Android toolchain - develop for Android devices (Android SDK version

28.0.3) 28.0.3)

• Android SDK at C:\Users\Callum\AppData\Local\Android\sdk • Android SDK 位于 C:\Users\Callum\AppData\Local\Android\sdk

• Android NDK location not configured (optional; useful for native • Android NDK 位置未配置(可选;对本机有用

profiling support)分析支持)

• Platform android-28, build-tools 28.0.3 • 平台 android-28,构建工具 28.0.3

• Java binary at: C:\src\Andriod studio\jre\bin\java • Java 二进制文件位于:C:\src\Andriod studio\jre\bin\java

• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343- • Java 版本 OpenJDK 运行时环境 (build 1.8.0_152-release-1343-

b01) b01)

• All Android licenses accepted. • 接受所有Android 许可证。

[√] Android Studio (version 3.4) [√] Android Studio(3.4版本)

• Android Studio at C:\src\Andriod studio • Android Studio 位于 C:\src\Andriod studio

• Flutter plugin version 35.0.1 • Flutter 插件版本 35.0.1

• Dart plugin version 183.6270 • Dart 插件版本 183.6270

• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343- • Java 版本 OpenJDK 运行时环境 (build 1.8.0_152-release-1343-

b01) b01)

[!] Connected device [!] 连接的设备

! No devices available没有可用的设备

. . Doctor found issues in 1 category.医生发现了 1 类问题。

but there are emulators available.但是有可用的模拟器。 Could the problem be the environment variables i have set?;问题可能是我设置的环境变量吗?

ANDRIOD_HOME- Value: C:\Users\Callum\AppData\Local\Android\Sdk ANDRIOD_HOME- 值:C:\Users\Callum\AppData\Local\Android\Sdk

Path- Value: C:\src\flutter\flutter\bin;%ANDRIOD_HOME%\tools;%ANDRIOD_HOME%\platform-tools路径-值:C:\src\flutter\flutter\bin;%ANDRIOD_HOME%\tools;%ANDRIOD_HOME%\platform-tools

Update 2更新 2

I have installed vscode.我已经安装了vscode。 the bottom right says no device, i clicked on it and chose a device(the devices I created in andriod studio were here).右下角说没有设备,我点击它并选择了一个设备(我在 andriod studio 中创建的设备在这里)。 I got the following error "Failed to launch emulator: Error: Emulator didn't connected within 60 seconds"我收到以下错误“无法启动模拟器:错误:模拟器在 60 秒内未连接”

Update 3更新 3

I tried to run ABD.exe from command prompt, i got the following error: "the program cannot start beacuse api-ms-crt-locale-l1-1-0.dll is missing from your computer. try reinstalling the program to fix this problem".我尝试从命令提示符运行 ABD.exe,出现以下错误:“程序无法启动,因为您的计算机缺少 api-ms-crt-locale-l1-1-0.dll。请尝试重新安装程序以修复这个问题”。 I then downloaded the missing dll and put it in the platform-tools folder.然后我下载了丢失的 dll 并将其放在 platform-tools 文件夹中。

I also installed C++ developer tools from the windows website as that contained the dll that i was looking for.我还从 Windows 网站安装了 C++ 开发人员工具,因为它包含我正在寻找的 dll。

I now get a 'the application was unable to start correctly (0xc000007b) click ok to close application.我现在收到“应用程序无法正确启动 (0xc000007b)”,单击“确定”关闭应用程序。

After all this, if i remove the dll from the platform tools folder, i still get the error "the program cannot start beacuse api-ms-crt-locale-l1-1-0.dll is missing from your computer. try reinstalling the program to fix this problem"毕竟,如果我从平台工具文件夹中删除 dll,我仍然会收到错误消息“程序无法启动,因为您的计算机缺少 api-ms-crt-locale-l1-1-0.dll。请尝试重新安装解决这个问题的程序”

I have the same issue, but in my case, the Emulator was already running successfully via Android Studio, so it was enough for me to just do the following steps:我有同样的问题,但就我而言,模拟器已经通过 Android Studio 成功运行,所以我只需执行以下步骤就足够了:

1. Run this command > "Flutter emulators"
2. Select the relevant emulator and run > "flutter emulators --launch Pixel_2_API_28"
3. Within your app folder path, run > "flutter run"

After the last command, you would get something like this message:在最后一个命令之后,你会得到类似这样的信息:

Using hardware rendering with device AOSP on IA Emulator.在 IA 模拟器上使用设备 AOSP 进行硬件渲染。 If you notice graphics artifacts, consider enabling software rendering with "--enable-software rendering".如果您注意到图形伪影,请考虑使用“--enable-software rendering”启用软件渲染。

Launching lib\main.dart on AOSP on IA Emulator in debug mode...在调试模式下在 IA 仿真器上的 AOSP 上启动 lib\main.dart...

Running Gradle task 'assembleDebug'...运行 Gradle 任务“assembleDebug”...

Running Gradle task 'assembleDebug'... Done运行 Gradle 任务“assembleDebug”...完成

在此处输入图像描述

Press Ctrl + Shift + P and click Launch EmulatorCtrl + Shift + P并单击Launch Emulator

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Android Studio 中的 Flutter 上运行模拟器时出错 - Error when running the emulator on Flutter in Android Studio Flutter 打开相机时应用程序崩溃模拟器 - Flutter App crashes emulator when opening camera 在模拟器中运行android应用时无布局 - No layout when running android app in emulator 在模拟器/手机中运行应用程序时出现 NoClassDefFoundError - NoClassDefFoundError when running app in emulator/phone 在Android模拟器中运行应用程序时出现问题 - Problem when running app in android emulator Android Studio,运行App时出现2个模拟器问题 - Android Studio, 2 Emulator problems when running App Flutter 应用程序在 Android 模拟器上运行,但不在物理设备上(OnePlus 7T) - Flutter app is running on Android Emulator but not on Physical Device (OnePlus 7T) 在Samsung设备上运行应用程序时出现NoClassDefFoundError,但在模拟器上运行时则没有 - NoClassDefFoundError when running app on Samsung device but not when running on an emulator 在真实设备上运行应用程序时出现NoClassDefFoundError,而在模拟器上运行时则没有 - NoClassDefFoundError when running app on real device but not when running on an emulator 应用未在模拟器中运行 - App not running in emulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM