Unable to run "adb", check your Android SDK installation and ANDROID_SDK_ROOT environment variable: ...\Android\Sdk\platform-tools\adb.exe

576

Try this step after not working on any of the steps I mentioned in the question.

The problem was in the antivirus program. It denied access to starting the flutter daemon on port 5037. I simply uninstalled the antivirus program from my device. Then it works like a charm.

Share:
576
Pulsara Sandeepa
Author by

Pulsara Sandeepa

Undergraduate at Faculty of Information Technology, University of Moratuwa Sri Lanka.

Updated on January 02, 2023

Comments

  • Pulsara Sandeepa
    Pulsara Sandeepa over 1 year

    When I start the project popup shows "Flutter daemon terminate" and when starting the flutter application it shows the "No Connected Devices Found" dialog box. Then I run flutter doctor -v doctor found issues in:

    Connected device (the doctor check crashed)
    X Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    X Exception: Unable to run "adb", check your Android SDK installation and ANDROID_SDK_ROOT environment variable: C:\Users\Pulsara\AppData\Local\Android\Sdk\platform-tools\adb.exe
    • #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
      #1      AndroidDevices.pollingGetDevices (package:flutter_tools/src/android/android_device_discovery.dart:78:7)
      <asynchronous suspension>
      #2      PollingDeviceDiscovery._populateDevices (package:flutter_tools/src/device.dart:413:54)
      <asynchronous suspension>
      #3      Future.wait.<anonymous closure> (dart:async/future.dart)
      <asynchronous suspension>
      #4      DeviceManager.getAllConnectedDevices (package:flutter_tools/src/device.dart:170:40)
      <asynchronous suspension>
      #5      DeviceValidator.validate (package:flutter_tools/src/doctor.dart:515:34)
      <asynchronous suspension>
      #6      asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:24)
      <asynchronous suspension>
    

    I already set up the SDK path as ANDROID_SDK_TOOLS in user variables and tools, and platform-tools in Path. And reinstalled the platform-tools as well but did not solve the issue. I cannot figure the solution if anyone can give me a solution it will be really appreciated.

    Tis below log displays in the Event Log:

    12/2/2021
    12:26 AM    'C:\Users\Pulsara\AppData\Local\Android\Sdk\platform- 
    tools\adb.exe start-server' failed -- run manually if necessary
    
    12:26 AM    'C:\Users\Pulsara\AppData\Local\Android\Sdk\platform- 
    tools\adb.exe start-server' failed -- run manually if necessary
    
    12:26 AM    * daemon not running; starting now at tcp:5037
    
    12:26 AM    * daemon started successfully
    
    12:26 AM    Adb connection Error:An existing connection was forcibly 
    closed by the remote host
    
    12:26 AM    Cannot reach ADB server, attempting to reconnect.
    

    I still couldn't solve the issue.

    • Vidyesh Churi
      Vidyesh Churi over 2 years
      Try deleting this folder C:\Users\%user%\AppData\Local\Android
    • Vidyesh Churi
      Vidyesh Churi over 2 years
      Try installing Android studio beta.
    • Pulsara Sandeepa
      Pulsara Sandeepa over 2 years
      I have done those steps but still not fixed.
    • Pulsara Sandeepa
      Pulsara Sandeepa over 2 years
      Is there any issue regarding tcp :5037 port?
  • Vidyesh Churi
    Vidyesh Churi over 2 years
    You need to add android folder in AppData, android installation, jdk and gradle to windows defender and antivirus exclusion.