Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Device emulator-5554 is not authorized. (Android)

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

like image 354
user2526586 Avatar asked Nov 30 '22 14:11

user2526586


2 Answers

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 !

like image 53
Mathis N Avatar answered Dec 04 '22 04:12

Mathis N


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

like image 21
Pastre Avatar answered Dec 04 '22 03:12

Pastre