模拟器-5554未经授权用于adb设备 [英] emulator-5554 unauthorized for adb devices

查看:643
本文介绍了模拟器-5554未经授权用于adb设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让我的react-native项目在Mac操作系统上的android模拟器上运行。

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.

在Mac上,我进入终端并输入 react-native run-android ,然后收到错误消息:

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

我键入 adb设备我看到了

List of devices attached
emulator-5554   unauthorized

我进入我的android模拟器的设置,进入设置内部版本号以多次点击它以启用开发人员选项。在开发人员选项中,我启用了USB调试,禁用了通过USB验证应用,并将所有其他设置保留为默认设置。我关闭了Android Studio和模拟器​​,然后重新启动了它。但是还是上面提到的相同问题。

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.

我在做什么错了?

编辑

我刚刚将Android手机连接到了Mac。当我运行 adb设备时,会看到此结果

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

List of devices attached
YLEDU16B18004313    device

但是当我运行 react-native运行时-android ,我收到与上述相同的错误。所以也许我的本机设置有问题吗?

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?

编辑2

我能够通过添加以下额外步骤将应用程序部署到Android手机上

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


  • chmod 755 android / gradlew

由于某些原因,当我键入从终端回显$ ANDROID_HOME ,我得到的结果是 / Users / John / Library / Android / sdk 。但是,如果将 echo $ ANDROID_HOME 行添加到我的 android / gradlew 文件中,它不会产生任何回声。当我运行 react-native run-android 命令时,编译器会抱怨未定义ANDROID_HOME。因此,我必须再次键入 export ANDROID_HOME = / Users / John / Library / Android / sdk ,然后运行 react-native run-android 命令有效并部署到我的手机上。

For some reason, when I type echo $ANDROID_HOME from 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 to my phone.

但是我的模拟器仍然无法正常工作。我收到的新错误消息是正在跳过设备 emulator-5554(emulator-5554):设备未授权,

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.

编辑3

我摆脱了未经授权的模拟器5554 进入我的Android虚拟设备并删除虚拟设备,从而出现错误。然后我重新安装了它。现在我的adb设备显示模拟器5554设备。而且我无法将应用程序部署到模拟器上。

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.

推荐答案

我的Mac系统上部署了react-native版本

I got my mac system to deploy a react-native build to my physical phone by following Edit 2 in the question.

我通过按照问题中的Edit 3,使我的mac系统为我的模拟器部署了一个react-native构建到我的物理电话。

I got my mac system to deploy a react-native build to my emulator by following Edit 3 in the question.

我认为问题通常是由于我的项目从Windows开发人员区域移至Mac开发人员区域引起的。然后,可能会发生各种不同的问题,导致每种情况下的构建失败。

I think the issue was generally caused by moving my project from a Windows dev area to Mac dev area. Then probably a combination of different issues happened that cause builds to fail for each situation.

这篇关于模拟器-5554未经授权用于adb设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆