Flutter - No Connected Device Found

If we try to run the "flutter devices" command to identify we are ready to connect our device with flutter for deploying our applications, it returns as:
 
$ flutter devices
  1. $ flutter devices   
  2.    
  3. No devices detected.  
  4. Run 'flutter emulators' to list and start any available device emulators.  
  5. 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.  
  6. • Device B2NGAA8831702707 is not authorized.  
  7. You might need to check your device for an authorization dialog.  
If you are setting up a Flutter development environment on Ubuntu, as mentioned in the documentation, you will need to verify that everything is fine with command "flutter doctor". Sometimes, (as we have seen during our first-time setup) you may see an error like the one below,
 
$ flutter doctor
  1. Doctor summary (to see all details, run flutter doctor -v):  
  2. [?] Flutter (Channel stable, v1.5.4-hotfix.2, on Linux, locale en_IN)  
  3. [?] Android toolchain - develop for Android devices (Android SDK version 28.0.3)  
  4. [?] Android Studio (version 3.4)  
  5. [!] Connected device  
  6. ! Doctor found issues in 1 category.  
This means in our setup eveything went fine, but the last step has an issue as shown with exclamation sign [!]. If we check a little deeper to identify what has been happening,
 
$ flutter doctor -v
  1. [ +35 ms] executing: /home/devlab/Android/Sdk/platform-tools/adb devices -l  
  2. [ +9 ms] Exit code 0 from: /home/devlab/Android/Sdk/platform-tools/adb devices -l  
  3. [ ] List of devices attached  
  4. B2NGAA8831702707 unauthorized usb:1-2 transport_id:1  
  5. [ +13 ms] No devices detected.  
As we can see above, flutter is using Android SDK tools sdb instead of your ubuntu installed adb. Let's see how it returns,
 
$ /home/devlab/Android/Sdk/platform-tools/adb devices -l
  1. List of devices attached  
  2. B2NGAA8831702707 unauthorized usb:1-2 transport_id:1  

Solution

  1. $ /home/devlab/Android/Sdk/platform-tools/adb kill-server   
  2. $ sudo /home/devlab/Android/Sdk/platform-tools/adb devices * daemon not running; starting now at tcp:5037 * daemon started successfully List of devices attached B2NGAA8831702707device   
  3. $ flutter devices 1 connected device: mymobilename • B2NGAA8831702707 • android-arm64 • Android 9 (API 28)   
Now, if we run "flutter doctor" it will not show any error: 
 
$ flutter doctor
  1. Doctor summary (to see all details, run flutter doctor -v):  
  2. [?] Flutter (Channel stable, v1.5.4-hotfix.2, on Linux, locale en_IN)  
  3. [?] Android toolchain - develop for Android devices (Android SDK version 28.0.3)  
  4. [?] Android Studio (version 3.4)  
  5. [?] Connected device (1 available)  
  6. • No issues found!   
If You Still Getting Confused, Please Click Here. Thank you.