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
$ /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
<pre> $ flutter devices 1 connected device: mymobilename • B2NGAA8831702707 • android-arm64 • Android 9 (API 28) </pre>
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!