简体   繁体   English

无法在反应本机“/bin/sh:adb:找不到命令”中访问我的android模拟器

[英]Can't access my android emulator in react native “/bin/sh: adb: command not found”

I use mac and setting up the development environment by React Native CLI Quickstart.我使用 mac 并通过 React Native CLI Quickstart 设置开发环境。 https://reactnative.dev/docs/environment-setup https://reactnative.dev/docs/environment-setup

It works for me in ios but in android i'm getting an error.它在 ios 中对我有用,但在 android 中我收到一个错误。

My steps:我的步骤:

1.open ~/.zshrc 1.打开~/.zshrc

2.add to the file 2.添加到文件

> export ANDROID_HOME=$HOME/Library/Android/sdk export
> PATH=$PATH:$ANDROID_HOME/emulator export
> PATH=$PATH:$ANDROID_HOME/tools export
> PATH=$PATH:$ANDROID_HOME/tools/bin export
> PATH=$PATH:$ANDROID_HOME/platform-tools
  1. save and run source ~/.zshrc 4.open emulator, run yarn android and getting the error:保存并运行 source ~/.zshrc 4.open 模拟器,运行 yarn android 并得到错误:

/bin/sh: adb: command not found. /bin/sh: adb: 命令未找到。

error Failed to launch emulator.错误 无法启动模拟器。 Reason: No emulators found as an output of emulator -list-avds .原因:找不到模拟器作为emulator -list-avds的输出。

warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT error Failed to start the app.警告无法使用“adb reverse”连接到开发服务器:spawnSync adb ENOENT 错误无法启动应用程序。 Error: spawnSync adb ENOENT at Object.spawnSync (internal/child_process.js:1070:20)错误:在 Object.spawnSync 的 spawnSync adb ENOENT (internal/child_process.js:1070:20)

** when i run "emulator -list-avds" i can see the emulator **当我运行“emulator -list-avds”时,我可以看到模拟器

Run the below three commands before running npm run android在运行 npm run android 之前运行以下三个命令

export ANDROID_HOME=/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 vscode使用反应本机工具运行反应本机项目,但找不到adb devices / bin / sh:adb:命令 - vscode use react native tools run react native project , but adb devices /bin/sh: adb: command not found 无法启动反应本机应用程序找不到模拟器 - Can't start react native app no emulator found React-Native 尝试运行 android,出现关于 /bin/sh 的错误:/usr/local/share/android-sdk/platform-tools/adb: No such file or directory - React-Native trying to run android, getting an error about /bin/sh: /usr/local/share/android-sdk/platform-tools/adb: No such file or directory 我无法在Mac OS中的Android模拟器上运行react-native-webrtc-demo - I can't run react-native-webrtc-demo on my android emulator in mac os ADB推送命令android模拟器 - ADB push command android emulator 使用 android 模拟器无法打开 React Native 项目 - React Native project can't be open with android emulator 无法在模拟器上运行 react-native android(Androidx 问题) - Can't run react-native android on emulator (Androidx problem) 无法在 react-native 故事书的 android 模拟器上看到故事 - Can't see stories on android emulator for react-native storybook 无法在 Atom 上使用模拟器 android 运行本机反应 - can't run react native with emulator android on Atom 当缺少/ system / bin / sh时,如何在android上获得有效的adb shell? - How can I get a working adb shell on android when /system/bin/sh is missing?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM