Flutter not detecting device / “flutter devices” No devices detected

If we tried to run “flutter devices” command to identify make sure we are ready to connect our device with flutter for deploying our applications, it returned as,

 $ flutter devices 
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 B2NGAA8831702707 is not authorized.
You might need to check your device for an authorization dialog.

If you are setting up Flutter development environment on Ubuntu, and as mentioned in documentation, you will need to verify that everything is fine with command “flutter doctor”, but sometimes ( as we seen during our first time setup ) you may see an error like as below,

$ flutter doctor 
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Linux, locale en_IN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Android Studio (version 3.4)
[!] Connected device

! Doctor found issues in 1 category.

This means in our setup eveything went fine, but the last step seen an issues as shown with exclamatory sign [!] , if we check little deeper to identify what has been happening,

$ flutter doctor -v 
[  +35 ms] executing: /home/devlab/Android/Sdk/platform-tools/adb devices -l
[   +9 ms] Exit code 0 from: /home/devlab/Android/Sdk/platform-tools/adb devices -l
[        ] List of devices attached
           B2NGAA8831702707       unauthorized usb:1-2 transport_id:1
[  +13 ms] No devices detected.

As we can see above, flutter is using Android SDK tools sdb instead of your ubuntu installed adb, hence lets see how it returns,

 $ /home/devlab/Android/Sdk/platform-tools/adb devices -l 
List of devices attached
B2NGAA8831702707       unauthorized usb:1-2 transport_id:1

Solution

 $ /home/devlab/Android/Sdk/platform-tools/adb kill-server 
 $ sudo /home/devlab/Android/Sdk/platform-tools/adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
B2NGAA8831702707	device
 $ flutter devices
1 connected device:

mymobilename • B2NGAA8831702707 • android-arm64 • Android 9 (API 28) 

Now, if we run “flutter doctor” it should not show any error as,

 $ flutter doctor 
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Linux, locale en_IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Android Studio (version 3.4)
[✓] Connected device (1 available)

• No issues found!
Android Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question