5

I am trying to use an emulator and when I launch it, it starts loading but its not getting conneccted in VSCode. How can I connect so that VSCode detects it?

When I start the adb-server, I get the following output

adb server version (40) doesn't match this client (39); killing...
ADB server didn't ACK
Full server startup log: /tmp/adb.1000.log
Server had pid: 31775
--- adb starting (pid 31775) ---
adb I 11-22 22:58:24 31775 31775 main.cpp:57] Android Debug Bridge version 1.0.39
adb I 11-22 22:58:24 31775 31775 main.cpp:57] Version 1:8.1.0+r23-5~18.04
adb I 11-22 22:58:24 31775 31775 main.cpp:57] Installed as /usr/lib/android-sdk/platform-tools/adb
adb I 11-22 22:58:24 31775 31775 main.cpp:57] 
adb I 11-22 22:58:24 31775 31775 adb_auth_host.cpp:416] adb_auth_init...
adb I 11-22 22:58:24 31775 31775 adb_auth_host.cpp:174] read_key_file '/home/sahil/.android/adbkey'...
adb I 11-22 22:58:24 31775 31775 adb_auth_host.cpp:391] adb_auth_inotify_init...
adb server killed by remote request

* failed to start daemon
error: cannot connect to daemon

flutter doctor logs:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.1+hotfix.4, on Linux, locale en_GB.UTF-8)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (version 3.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.35.1)
[!] Connected device

! Doctor found issues in 3 categories.

flutter devices logs:

No devices detected.

Run 'flutter emulators' to list and start any available device emulators.

Or, if you expected your device to be detected, please run "flutter doctor" to
diagnose potential issues, or visit https://flutter.dev/setup/ for troubleshooting
tips.

• Device emulator-5554 is offline.
1
  • 1
    This is most likely caused by having 2 versions of adb installed Commented Nov 23, 2019 at 1:32

6 Answers 6

3

The device does not have permissions. Run flutter doctor and flutter devices, if no devices appear to be connected (in this case, emulated) you need to kill the adb-server, open the emulator and then start the adb-server.

If the issue still persists after this, try flutter doctor --android licenses

And if it still continues, please post your flutter doctor & flutter devices output.

Regards

4
  • I'm using an emulator not a device. Commented Nov 22, 2019 at 17:10
  • Yep, I know. Still flutter devices needs to recognize the emulator. Commented Nov 22, 2019 at 17:16
  • Try the following: >adb kill-server > adb start-server If not, you just gotta find out where the adb-server is in your directory, Most likely where your Android SDK is. Commented Nov 22, 2019 at 17:19
  • For simulators on Mac, run flutter doctor too, most probably Xcode installation is not complete, you'll get instructions on how to sort it on terminal after running the command.
    – 6thsage
    Commented Oct 12, 2021 at 5:21
3

Most of the time, a simple restart for IDE and Emulator is enough. But in some cases restarting the machine is best. Among these solutions, you can try to restart adb server.

adb kill-server
adb start-server

Optional: Also, If you want to use your device without cable, you can root your device, then you can use adb over the air (If your device doesn't have that functionality. Modern devices have this option built-in.).

3

In my case, because I moved the android SDK to different path, not default in c:, so the vs code wont detect the emulator.

resolve

  1. Go to Android SDK folder
  2. find a folder called "platform-tools"
  3. copy the path, and add it to environment variables
  4. restart vs code
1
  • Worked perfectly! Thanks so much! Commented Aug 21 at 20:03
2
  1. Disabled and Enabled Flutter plugin
  2. Disabled and Enabled Dart plugin
  3. Restarted Vscode
  4. Restarted PC

Try these four options one by one, hope the problem will be solved.

1

In my case, VSCode was not detecting any devices, but flutter doctor was. This is what worked for me on Ubuntu 20.04.4:

sudo kill -9 $(pgrep Electron) to kill all instances of VSCode and then restart VSCode.

0

For my case I launched the emulator using cold boot whenever VS code did not detect the emulator. I hope this helps someone.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Nov 2, 2022 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.