flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.37k stars 27.55k forks source link

Flutter devices not detecting devices whereas the android adb device is working #153921

Open SubashBalasubramanian opened 2 months ago

SubashBalasubramanian commented 2 months ago

Have installed the latest android and flutter version. But flutter is not able to detect the android devices.

Tried below Steps but none worked : 1) Have added the flutter and android sdk path to the environment varaiables. 2) Have enabled usb debugging on phone. 3) Have changed the usb cable and port.

Have attached the flutter doctor -v, flutter devices -v, adb devices screenshots for your reference.

Can you tell us what might be the issue? There is no proper error messages were displayed. So unable to figure out the issue.

Also flutter devices --device-timeout=60 also not scanning devices for 60 seconds. It takes same time as flutter devices command takes.

Note : windows OS is reimaged with organization custom windows OS.

adbcmd

flutter_doctor flutterdevices computerProperties

huycozy commented 2 months ago

Hi @SubashBalasubramanian Can you try adding an Android emulator to see if it shows up on the output list? Also, can you check on another physical device if any?

SubashBalasubramanian commented 2 months ago

Have tried adding emulators, it is showing in the list. And connected with multiple devices, it is not listing in flutter devices, whereas the devices are shown in adb command. flutter_emulator

huycozy commented 2 months ago

Thanks for checking that. Please provide the information in text format instead of a screenshot for better readability and investigation, see avoid posting screenshots of text.

From your flutter devices -v output above, I see the empty output of adb.exe devices -l. Can you also try executing this command on Command Prompt? If this output is not empty, that could be an issue in Flutter tool when parsing the output from adb command.

SubashBalasubramanian commented 2 months ago

Please find the output that was obtained in command prompt, ADB :

C:\Users\NPotturu>adb.exe devices -l
List of devices attached
NVUOWGPJYXPR85O7       device product:RMX3771 model:RMX3771 device:RE58B8L1 transport_id:25
VO4XYDVKS8UKIZE6       device product:DN2101IND model:DN2101 device:OP515BL1 transport_id:24
emulator-5554          device product:sdk_gphone16k_x86_64 model:sdk_gphone16k_x86_64 device:emu64xa16k transport_id:2

Flutter :

C:\Users\NPotturu>flutter devices -v
[  +18 ms] Could not interpret results of "git describe": 3.25.0-1.0.pre.104
[ +246 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +5 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[  +11 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[   +1 ms] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +156 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[  +84 ms] executing: C:\software\AndroidSdk\platform-tools\adb.exe devices -l
[ +119 ms] Found 3 connected devices:
[  +52 ms]   Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.4651]
[  +19 ms]   Chrome (web)      • chrome  • web-javascript • Google Chrome 127.0.6533.120
[   +2 ms]   Edge (web)        • edge    • web-javascript • Microsoft Edge 127.0.2651.105
[   +2 ms] executing: C:\software\AndroidSdk\platform-tools\adb.exe devices -l
[  +98 ms] 
Run "flutter emulators" to list and start any available device emulators.
  If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the
"--device-timeout"
           flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
[  +32 ms] "flutter devices" took 628ms.
[ +190 ms] ensureAnalyticsSent: 144ms
[  +23 ms] Running 1 shutdown hook
[   +2 ms] Shutdown hooks complete
[  +10 ms] exiting with code 0
huycozy commented 2 months ago

Thanks for the update. I just found a similar issue where user solved it by Windows environment variable path settings: https://github.com/flutter/flutter/issues/73200#issuecomment-770320006. Can you please try and confirm if it works?

SubashBalasubramanian commented 2 months ago

I have tried that already and reconfirmed that it was added in environmental variable path. Still not working. envVariable

huycozy commented 2 months ago

Thanks for the update. I will label this issue to consult insight from others.

andrewkolos commented 2 months ago

Looks like this isn't specific to a single model of phone, since I see two devices listed by adb in https://github.com/flutter/flutter/issues/153921#issuecomment-2306963493 that are not listed by Flutter.

Unfortunately, we do not have the bandwidth to investigate setup issues experienced by individual users.

SubashBalasubramanian commented 2 months ago

@andrewkolos We are not seeing this issue in single Laptop, we have setup android and flutter in 5-6 laptops (Dell precision 5xxx). We couldn't get the devices listed in Flutter devices with proper error message. So we could not move further. If we get proper error message, we can able to solve the issue by ourself.

andrewkolos commented 2 months ago

We couldn't get the devices listed in Flutter devices with proper error message. So we could not move further. If we get proper error message, we can able to solve the issue by ourself.

The problem is that Flutter cannot detect the device to begin with. It cannot produce an error message regarding something it does not know exists.

Regardless, it seems like this problem is not specific a single model of phone^1 and is reproducible on multiple machines (though they might be set up identically), so I'm reopening this for the Android team's consideration.

reidbaker commented 2 months ago

I dont use windows but I have in my career run into issues where adb is running on multiple ports and one set of commands cant see the other set. In your command prompt before running flutter devices can you try killing all running versions of adb (using adb kill-server and verifying in the task manager). Then try running flutter devices.

Second question, can you ever see android devices in flutter devices or are you only getting windows and web devices?

reidbaker commented 2 months ago

Also can you confirm that the adb version you are running is the same one found in software/Androidsdk

SubashBalasubramanian commented 2 months ago

1) Tried killing adb kill-server and adb start-server, After that called "Flutter devices" , still i coudnt find the connected devices. I am just getting "!" symbol.

2) I have seen only once out of 30 attempts using flutter devices, the second after that I called flutter devices, it does'nt get listed.

3) The adb version is same in both the cases.

Vordead commented 4 days ago

@SubashBalasubramanian Hello have you found any solution for this? As we are experiencing the same issue on Windows 11 laptops at my company. Flutter devices are not being detected but they are visible in adb devices. On Mac laptops no issues were found.