Reputation: 20244
adb
connects to my device (Xiaomi Redmi 4, MIUI 11.0.2, Android 7.1.2) just fine via USB as well as via WiFi. However, I've had no success trying to connect flutter. Flutter does detect my device when I connect via USB but doesn't prompt for an Authorization dialog:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.14.6, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Android Studio (version 3.6)
[!] Connected device
! Doctor found issues in 1 category.
$ 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 9fd66a407d14 is not authorized.
You might need to check your device for an authorization dialog.
I've tried
adb kill-server
and adb start-server
along with disconnecting and reconnecting my devicebut flutter still says that my device is not authorized.
Is there a solution for this?
Upvotes: 5
Views: 4150
Reputation: 1
I am using windows 10, I don't think it helping you directly, I just want to share how my problem solved and may help someone out there
using android studio - find menu tools > sdk manager
at sdk manager find -> Appearance & Behavior | System Settings | Android SDK at android sdk find SDK Tools Menu and Install Google USB Driver
at Device Manager (Win + R -> devmgmt.msc) install Google USB Driver for the adb (in my case my phone is installed already and I update the driver).
after that we have to connect out phone and trust the computer (I suggest to turn on usb debugging first and revoke all usb debugging permission in developer option)
Upvotes: 0
Reputation: 3802
As Mr Darish suggested... Settings -> Additional settings -> Developer options --> Revoke USB Debugging and Disconnect your device(This removes previous authorization and ask for new) .
But sometimes it does not work. So just go to Settings -> Additional settings -> Developer options -> Select USB configuration -> Select Charging option there. And it will show autorization dialog.
Upvotes: 3
Reputation: 20244
I had another issue with adb
in which when I connect to my device via USB or WiFi, it would prompt me for authorization even after I check "Always allow from this computer" (This was the case for more than a year and I never really knew why)
Turns out that was because I had ~/.android/adbkey
owned by the root user. So as a normal user, adb
won't be able to write to that file which means that it wouldn't be able to remember devices. I solved that with the steps in this answer:
As described in this issue, this can happen if you run
adb
for the first time as root. It creates a key file on your computer owned by the root user, so your normal user account can't read or overwrite it.To check if this is the case:
$ ls -l ~/.android/adbkey -rw------- 1 root root 1708 Nov 13 2012 .android/adbkey ^ notice root here
To fix it:
$ sudo chown $USER: ~/.android/adbkey $ ls -l ~/.android/adbkey $ -rw------- 1 thomas thomas 1708 Nov 13 2012 /home/thomas/.android/adbkey ^ now shows your username and primary group
Finally, restart the adb server:
$ adb kill-server $ adb start-server
Once I solved that, Flutter worked perfectly!
Upvotes: 4
Reputation: 11481
You can try revoking USB RSA fingerprints and reconnecting.
Here you go.
Settings -> Additional settings -> Developer options --> Revoke USB Debugging and Disconnect your device.
After reconnecting, you will get a RSA Fingerprint verification window, click on accept. Done.
Note: If your phone has configured for multiple user accounts, make sure you are on the main user account (administrator).
Upvotes: 1