6

I have run into similar problem like this: [emulator-5554 unauthorized for adb devices [1]

Basically, I am trying to do some flutter programming on an Android Virtual Device with my Windows 10... although I don't think this problem is flutter-specific.

After starting the virtual device, I ran

flutter doctor -v

Everything seemed fine, except for

[!] Connected device
• Device emulator-5554 is not authorized.
  You might need to check your device for an authorization dialog.

When I run

flutter devices

I get this:

No devices detected.
Run 'flutter emulators' to list and start any available device emulators.

When I run

flutter emulators

I get

1 available emulator:
Nexus_5X_API_28
To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.

For days, I have tried almost everything from the post above.I have googled about it but I haven't found anything that can really solve my problem here: I have tried deleting the AVD and creating a new one; I have tried removing the pair of adbkey files; I have tried killing adb server and restarting; I have tried turning on and off the debugging mode/USB debugging; I have tried wiping the data and cold starting for the AVD; I have tried updating the SDK tools..... I have been repetitively trying all these for days and I still get no success. I wonder what I have done wrong here...

Really hope someone can give me some sound advice here. Thank you in advance!

Note: I created my AVD on Android Studio. I ran flutter doctor on command prompt. Don't know if that has got anything to do with this.

[1]: emulator-5554 unauthorized for adb devices

user2526586
  • 972
  • 2
  • 12
  • 27

9 Answers9

12

I found the solution guys !! I was stuck but it's actually quite simple !

So, I got the problem with the Pixels 2 and 2 XL API 28 (Pie) and here's what to do :

  • Set and run the device normally

  • Turn on the developer features : go to the settings, then 'System', 'About Emulated Device', tap 5 times on 'Build Number'

  • Go back, reveal the advanced options, then go to 'Developer Options'

  • Make sure 'USB debugging' is on

  • Find 'default USB configuration'

  • Click on it, it will open a menu, then select 'File Transfer' instead of 'No data transfer'

  • I think it's good but you can also click inside your notifications on 'Virtual SD card' and set it for transferring photos and media, in order to be sure

  • Open your PowerShell (or cmd, or what you want) with the emulator still opened and check if it's getting recognized with 'flutter doctor' or 'flutter devices'

  • Go to your project folder with 'cd [your folder's path]

  • Type 'flutter run' to launch your app in the emulator

It should work! It did for me, I think the problem comes from the USB default configuration. I hope it helped, have a nice programming session !

wwkudu
  • 2,778
  • 3
  • 28
  • 41
Mathis N
  • 209
  • 1
  • 3
  • Im not sure why this comment got a downvote, android studio might not have the authority to access the current device emulator. In order to do that, you can give the access permission by turn on the usb debugging mode inside the device emulator's setting. Another way is you can re-run the android studio as administrator or create a new emulator. – Alvin Tom May 16 '19 at 16:34
  • *Default USB configuration* worked for me - I selected *USB tethering*, and followed the prompts. – qujck Apr 07 '20 at 18:34
  • this is what works especially on visual studio code. – Geoff Oct 06 '21 at 10:04
  • in VSCode after all do all of up tips you must close your editor and reopen this – Akbar Asghari Oct 07 '21 at 08:12
  • +1 this answer. Using windows, you may need to close and re-open Android studio. Windows may prompt you to "Allow Access" to the service "adb.exe". – Joe W Sep 27 '22 at 04:41
5

Solved it by creating a Nexus emulator instead of a Pixel 2

Pastre
  • 684
  • 8
  • 17
4

I tried all above proposed solutions and others but none worked with me. But the following solved it:

The problem was in '.android' files

Delete the entire '.android' folder and re-create the emulator again using AVD manager and the folder will be re-created again in the same location.

The default path of '.android' folder is 'C:\Users\***\.android' unless you changed it.

3

I don't know if this is really the solution for it.

Today I have tried creating a different AVD with a different image (Same API level). The new AVD works!

I wonder if it is the case that the old image was buggy or whatsoever - even though that was an official Google Play image.

My new image was not official, I guess, but it works and connects without problem.

user2526586
  • 972
  • 2
  • 12
  • 27
2

I solved it by turning off USB Debug mode in my virtual device and turning it On Again.

AleFachini
  • 155
  • 1
  • 8
  • This worked for me. The fix happens when you give permission to Allow USB debugging. Run Flutter doctor right after to see the device without the msg : "...is not authorized". I assume I accidentaly clicked on cancel the previous time which cancels the authorization. – DanielBkr Mar 10 '23 at 16:03
1

I had experienced the same problem and tried to fix it in many ways. For my case, I could find a simple solution as doing Android studio updates. Here is the information for updates.

IDE and Plugin Updates: The following components are ready to update: Android Emulator, Android SDK Platform-Tools

JForce
  • 11
  • 2
1

delete all the devices on android virtual dvice manger and creat a new one and run it from thereenter image description here

MOKIT
  • 41
  • 1
0

The accepted answer in a Android studio Emulator ( device unauthorized)

Issue Resolved.

Step 1- Made a new emulator(Any).

Step 2- then fixed another problem the black screen by changing the settings to use hardware graphics.(Dunno if this problem was related to the bug)

And Bam every thing worked.

Miguel Ruivo
  • 16,035
  • 7
  • 57
  • 87
0

This happens to me every second week too. The only way I found it to fix this is to click "Wipe Data" in Android Virtual Device Manager (you can find it in the menu that comes up when you click on the arrow that faces downwards). Unfortunately this implies that you have to set up your emulator from scratch.

masewo
  • 801
  • 9
  • 11