简体   繁体   中英

How can I connect Flutter in VS Code with the BlueStacks 4 emulator?

How can I connect Flutter with VS Code to emulator BlueStacks 4. I do not want to use Android Studio because it is bad software. Can someone help me please?

For this we need to establish ADB(Android Debug Bridge) connection between VScode and Android Emulator(Bluestacks) which has PID(Process identifier) 5555

For time save first check, status bar of VScode to check device connection. Two case possible show below :
在此处输入图像描述

在此处输入图像描述

If you are fall under 2nd case so it is good to go with debugging. And no need look at other points.

In all other case let's establish connection. Steps are

  1. Open Bluestacks and go to settings by clicking on like icon. 在此处输入图像描述
  2. Then move to preferences and then scroll down and turn on Abd connection
  3. In terminal type adb connect localhost:5555 在此处输入图像描述
  4. Now check again status bar in VScode. Status of devices will be present

Yes, you can do it. Just open bluestacks and go to settings. Then go to preferences and tick the checkbox just beside the option enable Android Debug Bridge(ADB). Then if you open Visual Studio Code and search for devices you will find bluestacks android emulator in the list of devices.

Hope it helps...

step 1: go to setting button on bluestack enter image description here

step 2: then go to the advance and ensure that ADB is turn on enter image description here

step 3: after that, you must to restart your bluestacks, then open a terminal and go to your Android SDK folder: ../Android/Sdk/platform-tools/ and copy this path enter image description here

step 4: Now change the directory by cd with this path and run this command: adb connect localhost:5555 if this command is not working then use this command : .\adb connect localhost:5555 enter image description here

step 5: Now choose the device and run your project. It may take some times so keep patient for that. enter image description here

The VS Code extension uses the flutter devices command to find devices. This is turn uses adb devices . In order for emulators to be usable in VS Code you should make sure that a) it shows up in adb devices and b) Flutter is able to find your Android SDK (the best way to check if this is the case is running the Flutter: Run Flutter Doctor command from the VS Code command palette, which will run doctor with the same environment that VS Code has).

You have to enable adb on BlueStacks Configs. It is on Right upper side Gear, Config / Advanced / enable adb

Hope You can use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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