颤动运行:没有连接的设备 [英] flutter run: No connected devices

查看:78
本文介绍了颤动运行:没有连接的设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用flutter创建示例应用程序(全新安装),同时还安装了android studio(全新安装)

I am trying to create a sample application with flutter (fresh installation) android studio is also installed (fresh installation)

这是flutter run

flutter run  
No connected devices.

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.1.5, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] Android Studio (version 3.0)
[!] VS Code (version 1.20.1)
[!] Connected devices
! No devices available

! Doctor found issues in 2 categories.

这个问题有解决方案吗?

Is there a solution to this problem?

推荐答案

Flutter支持iOS和Android设备/模拟器.

Flutter supports both iOS and Android device/simulators.

在终端中,运行flutter devices命令以验证Flutter是否可以识别您连接的Android设备.

In terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device.

这里是参考文档,如何设置设备/仿真器以运行您的应用程序.

Here is a reference document, How you can setup Device/Simulator to run your application.

要准备在Android设备上运行和测试Flutter应用,您需要运行Android 4.1(API级别16)或更高版本的Android设备.

To prepare to run and test your Flutter app on an Android device, you’ll need an Android device running Android 4.1 (API level 16) or higher.

  1. 在设备上启用开发人员选项和USB调试.详细说明可在Android文档中找到.
  2. 使用USB电缆将手机插入计算机.如果您的设备上出现提示,请授权您的计算机访问您的设备.
  3. 在终端中,运行flutter devices命令以验证Flutter是否可以识别您连接的Android设备.
  4. 通过运行flutter run启动您的应用.
  1. Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.
  2. Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.
  3. In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device.
  4. Start your app by running flutter run.

默认情况下,Flutter使用adb工具所基于的Android SDK版本.如果要Flutter使用其他安装的Android SDK,则必须将ANDROID_HOME环境变量设置为该安装目录.

By default, Flutter uses the version of the Android SDK where your adb tool is based. If you want Flutter to use a different installation of the Android SDK, you must set the ANDROID_HOME environment variable to that installation directory.

要准备在Android模拟器上运行和测试Flutter应用,请按照以下步骤操作:

To prepare to run and test your Flutter app on the Android emulator, follow these steps:

  1. 在计算机上启用VM加速.
  2. 启动Android Studio>工具">"Android">"AVD管理器",然后选择创建虚拟设备".
  3. 选择设备定义,然后选择下一步".
  4. 为要模拟的Android版本选择一个或多个系统映像,然后选择下一步".建议使用x86或x86_64图像.
  5. 在模拟性能"下,选择硬件-GLES 2.0"以启用硬件加速.
  6. 验证AVD配置是否正确,然后选择完成".

  1. Enable VM acceleration on your machine.
  2. Launch Android Studio>Tools>Android>AVD Manager and select Create Virtual Device.
  3. Choose a device definition and select Next.
  4. Select one or more system images for the Android versions you want to emulate, and select Next. An x86 or x86_64 image is recommended.
  5. Under Emulated Performance, select Hardware - GLES 2.0 to enable hardware acceleration.
  6. Verify the AVD configuration is correct, and select Finish.

有关上述步骤的详细信息,请参阅管理AVD.

For details on the above steps, see Managing AVDs.

在Android虚拟设备管理器中,单击工具栏中的运行".模拟器启动,并显示所选操作系统版本和设备的默认画布.

In Android Virtual Device Manager, click Run in the toolbar. The emulator starts up and displays the default canvas for your selected OS version and device.

-

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆