[英]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
/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.