简体   繁体   English

如何在没有 android 工作室模拟器的情况下在 VSCode 中运行 flutter 应用程序

[英]how to run flutter app in VSCode without android studio emulator

I want to run flutter app in VS.Code without android studio emulator .我想在没有android studio emulatorVS.Code中运行 flutter 应用程序。 I want run my app without install android studio .我想在不安装 android studio的情况下运行我的应用程序。 How can I do this?我怎样才能做到这一点?

If you have Gradle properly installed globally ( https://gradle.org/install/ ) and the Android SDK setup on your machine, then you should not need the IDE.如果您在全球范围内正确安装了 Gradle ( https://gradle.org/install/ ) 并且在您的机器上安装了 Android SDK,那么您应该不需要 IDE。

Try first checking for available devices:首先尝试检查可用设备:

flutter devices

Then using the device that you find (if there are any spaces in the name that represents the device then use "" to format the command), execute the following command:然后使用您找到的设备(如果名称中有任何表示设备的空格,则使用“”来格式化命令),执行以下命令:

flutter run -d "Device Name With Spaces" --release 

Or:或者:

flutter run -d DeviceNameWithoutSpaces --release

The first option is You can run your application on chrome or edge if you don't want to download an emulator.第一个选项是如果您不想下载模拟器,您可以在 chrome 或 edge 上运行您的应用程序。 Follow the following steps:请按照以下步骤操作:

  1. Click on the no-device option to select the device.点击无设备选项到 select 设备。
  2. Now select chrome or edge现在 select chrome 或 edge

And the second option is you can connect your mobile with your PC and use your phone to run the flutter apps.第二个选项是您可以将手机与 PC 连接并使用手机运行 flutter 应用程序。 Follow the following steps: For Android:按照以下步骤操作: 对于 Android:

  1. Enable developer options and USB Debugging on your device.在您的设备上启用开发者选项和 USB 调试。 This varies slightly by android version.这因 android 版本而略有不同。 But the short version is you tap on the device build number 7 times.但简短的版本是您点击设备内部版本号 7 次。

  2. Then a “Developer Options” option comes up.然后出现“开发人员选项”选项。 After that, you can click “enable USB Debugging.”之后,您可以点击“启用USB调试”。

  3. Then plug your phone into your computer with a USB cable.然后使用 USB 数据线将手机插入计算机。 You'll see some popup on your phone asking if you want to allow USB debugging with that computer.您会在手机上看到一些弹出窗口,询问您是否要允许 USB 使用该计算机进行调试。 Click on “yes”.单击“是”。

  4. Run Flutter just like you would if you had a simulator running.运行 Flutter 就像运行模拟器一样。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM