Barak
Barak

Reputation: 734

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. https://reactnative.dev/docs/environment-setup

It works for me in ios but in android i'm getting an error.

My steps:

1.open ~/.zshrc

2.add to the file

> 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:

/bin/sh: adb: command not found.

error Failed to launch emulator. Reason: No emulators found as an output of emulator -list-avds.

warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT error Failed to start the app. Error: spawnSync adb ENOENT at Object.spawnSync (internal/child_process.js:1070:20)

** when i run "emulator -list-avds" i can see the emulator

Upvotes: 1

Views: 5006

Answers (1)

Sourav Dey
Sourav Dey

Reputation: 1150

Run the below three commands before running npm run android

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

Upvotes: 3

Related Questions