Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emulator-5554 unauthorized for adb devices

I'm trying to get my react-native project to run on an android emulator while on a Mac operating system. It worked fine on my windows.

On my Mac, I go to terminal and type react-native run-android and I get the error message:

$ react-native run-android
Scanning 616 folders for symlinks in /Users/John/Documents/myreactnativeproject/node_modules (17ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

I type adb devices and I see

List of devices attached
emulator-5554   unauthorized

I go into the settings of my android emulator, I go to Settings Build Number to tap it several times to enable Developer options. In developer options, I enabled USB debugging, disabled Verify apps over USB, and left everything else as default. I shut down my android studio and emulator, restarted it. But still, the same issues mentioned above.

What am I doing wrong?


EDIT

I just connected my android phone to my Mac. When I run adb devices, I see this result

List of devices attached
YLEDU16B18004313    device

But when I run react-native run-android, I get the same error as above. So maybe there is something wrong with my react-native set up instead?


EDIT 2

I was able to deploy the app to my android phone by adding these extra steps

  • chmod 755 android/gradlew

  • For some reason, when I type echo $ANDROID_HOME into the terminal, I get the result /Users/John/Library/Android/sdk. But if I add the echo $ANDROID_HOME line to my android/gradlew file, it echoes nothing. And when I run the react-native run-android command, the compiler complains that ANDROID_HOME is not defined. So I have to type export ANDROID_HOME=/Users/John/Library/Android/sdk again, then running the react-native run-android command works and deploys it to my phone.

However, my emulator still doesn't work. The new error message I get is that Skipping device 'emulator-5554' (emulator-5554): Device is UNAUTHORIZED,.

But at least I have a temporary solution, and to debug with my phone.


EDIT 3

I got rid of the emulator 5554 unauthorized error by going into my Android Virtual Devices and deleting the virtual device. Then I re-installed it. And now my adb devices shows emulator 5554 device. And I am not able to deploy the app to my emulator.

like image 958
John Avatar asked Oct 23 '17 20:10

John


People also ask

How do I resolve Android emulator 5554 offline?

Go to cmd and type adb kill-server. Go to task manager and find adb in processes. If you find one, right click on it and click on end process tree. In eclipse, go to Window>Android Virtual Device Manager, click on the AVD you want to launch, click on start and uncheck "Launch From Snapshot" and then click on launch.


8 Answers

In my case, Create a Virtual Device with Google APIs Image, not Google Play Image worked for me.

The problem occurs the only emulator that runs on Android Pie others don't.

In Android Studio

  1. Open an Android Virtual Device Manager.
  2. Create a new Virtual Device.
  3. Select any Hardware you want.
  4. Select any System Image which the Target is "(Google APIs)" not "(Google Play)" (If you don't found. Try to look at "x86 Images" tab or "Other Images" tab)
  5. Done!
like image 84
user8637708 Avatar answered Oct 04 '22 13:10

user8637708


Android emulators have by default "Usb Debugging" in settings. You just need to wipe the data of the emulator. Do the following steps. It will work :---

  1. Close the emulator and run the command adb kill-server in the command prompt. If adb is not set in you path then you might run this command from directory where adb is present.
  2. Click on Wipe Data option from avd Actions menu. enter image description here

  3. Now run the emulator. It should work.

like image 36
srs Avatar answered Oct 04 '22 13:10

srs


create new Virtual Device, and make sure you choose Google API's. enter image description here

run the new device!. this should work

enter image description here

like image 23
Mang Ndie Avatar answered Oct 04 '22 12:10

Mang Ndie


In my case, following steps worked

  1. Wipe data from avd manager
  2. Cold boot now
like image 25
Rohit Mandiwal Avatar answered Oct 04 '22 13:10

Rohit Mandiwal


I managed to authenticate the adb on a Pixel 2, Android 9.0 (Google Play), API 28, x86_64 virtual device (Intel HAXM). The problem should be related to the Extended Controls (the 3 dots bottom icon menu, when the virtual device is booted), the Google Play menu, that is checking the version of the Google Play services. When adb is not 'unauthorized', this page is displaying the correct version, and the Update button opens inside the phone the Play Store with the Play Services app, so you can update it.

The steps I took to be able to authenticate are:

  1. Make sure the USB debugging is turned ON in Dev setting
  2. Revoke the USB debugging authorizations
  3. Make sure the Extended Controls > Settings > Advanced > Open GL options are set to the: 'Desktop native OpenGL' and 'Renderer maximum (up to OpenGL ES 3.1)', so the emulator interface, animations, etc, are fast!
  4. Power off the emulator
  5. In 'Your Virtual Devices' in Android Studio, click the down arrow in Actions > Select 'Cold Boot Now'
  6. When the device boot, you have to be fast, the dialog to remember and accept the USB connection will show and disappear for like less than 1 second (again I guess related to some automation scripts kicking, idn).

If you manage to click the 'remember' and 'ok' checkbox and button before the dialog disappears, you are done. Else you have to Power Off and Cold Boot again.

After that, don't wipe your emulator, else you'll have to do that insane race clicking again!

like image 22
Milen Boev Avatar answered Oct 04 '22 12:10

Milen Boev


Creating an emulator with graphics set to "Software - GLES 2.0" worked for me (Nexus 6 image).

I was initially using a Nexus 5X image which didn't allow me to select the graphics option.

NOTE: I went through the steps mentioned in EDIT 2 and EDIT 3 by the OP before doing this.

like image 28
AndyFaizan Avatar answered Oct 04 '22 12:10

AndyFaizan


I run adb kill-server and adb devices. the device will back again. for Emulator, the default settings is debug enabled

like image 33
Jesse Avatar answered Oct 04 '22 13:10

Jesse


This can happen if USB debugging is not enabled on the emulator device.

Go to the emulated device, enable the Developer options and enable USB debugging.

enable USB debugging

like image 37
mangei Avatar answered Oct 04 '22 11:10

mangei