1

I created a new react native app by using the expo cli. iOS Xcode Emulator is working fine but getting below error for android emulator

Error: spawn adb ENOENT

I tried to uninstall and install back expo-cli. Tried to delete the emulator and create a new one. None of them is working.

user19222827
  • 29
  • 1
  • 3

1 Answers1

5

I was in your same situation wherein I’d just installed expo and tried to run the app in an emulator on my Mac.

Apparently the problem was that ANDROID_HOME and adb weren’t set in my $PATH.

I solved it by referring to Option 3 (I already had android studio installed) of the top voted answer here. 

In case you want to know what I did, I use ohmyzsh by default so I did the following:

nano .zshrc

Add these two lines in the .zshrc file.

export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Then run this in your terminal:

source ~/.zshrc

Restart your terminal and now everything works!

  • I've been struggling with this issue for hours. Fixing the $PATH fixed it. Upvoted. – Almir Campos Jan 09 '23 at 01:59
  • Totally the same to my situation, using expo and met this error while started a preview, and I also using ohmyzsh. But the path of my Android/sdk is slightly different. So to somebody coming for the answer, here is the reminder, don't just copy and paste, change the path to your android sdk's path. – j3rry Mar 21 '23 at 06:06
  • This answer help me to solve same problem on linux. Thanks – lesimoes May 21 '23 at 16:09