Error running the React application on android emulator

Asked

Viewed 1,699 times

1

**error emulator**

I can’t open an React Native project in the emulator, I’ve tried using Genymotion and Android Studio but always the same error occurs when I run: sudo react-native run-android

27 actionable tasks: 2 executed, 25 up-to-date
/bin/sh: 1: adb: not found
info Connecting to the development server...
warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
info Starting the app...

3 answers

2

The Error indicates that the adb was not found:

/bin/sh: 1: adb: not found 

Probably if you try to use the command adb devices in your terminal it must report the same error.

One solution for this is you add to $PATH system: the location of the platform-tools/ of his android-sdk, example:

PATH=$PATH:/exemplo-de-path-absoluto/android-sdk-linux/platform-tools/
export PATH

On my computer I leave this command at the end of the file .bashrc which is in my user directory: /home/meu-usuario

Lembando that if you add the command to .bashrc you will need to 'reload' that file, for this you can use the command source[1] [2]:

$ source ~/.bashrc

~/ shortcut to current user directory [1], that is, in my case /home/meu-usuario

0

As Icaro said, you need to set or export the folder where adb.exe is for the PATH environment variable, try to see if it is there with

echo $PATH | grep platform-tools.

If not, you will need to check where the platform-tools (when you installed Android SDK via Android Studio) and edit your $PATH accordingly:

export PATH=$PATH:</caminho/para/seu/Android/Sdk/platform-tools>

-2

adb -s reverse tcp:8081 tcp:8081

you have to enter this in your terminal to connect with the device connected via usb

Browser other questions tagged

You are not signed in. Login or sign up in order to post.