microsoft / vscode-react-native

VSCode extension for React Native - supports debugging and editor integration
https://marketplace.visualstudio.com/items?itemName=vsmobile.vscode-react-native
Other
2.63k stars 267 forks source link

/bin/sh: 1: adb: not found #1196

Closed thejacer87 closed 4 years ago

thejacer87 commented 4 years ago

Actual Behavior

  1. Select "React native: Run Android on device/emulator" or "Debug Android".
  2. Get error "adb not found".

Expected Behavior

  1. Run app on android device/emulator

Software versions

Outputs (Include if relevant)

[Info] Prewarming bundle cache. This may take a while ...

[Info] Entry point doesn't exist neither at index.js nor index.android.js. Skip prewarming...

[Info] Building and running application.

[Error] Error: Error while executing command 'adb devices': Command failed: adb devices /bin/sh: adb: command not found

i read through https://github.com/microsoft/vscode-react-native/issues/723 and tried to follow the fix there (moving the android path variables from .bashrc to .bash_profile), and it didn't change anything. 

here's my path: 

$ echo $PATH /home/thejacer87/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/thejacer87/Android/flutter/bin:/home/thejacer87/Android/Sdk/platform-tools


when i tried running `code .` from the terminal, then tried to debug, i got a slightly different output:

Loading dependency graph, done. [Info] Packager started.

[Info] Prewarming bundle cache. This may take a while ...

[Info] Entry point doesn't exist neither at index.js nor index.android.js. Skip prewarming...

[Info] Building and running application.

[Error] Error: Android project not found. (error code 1203)

RedMickey commented 4 years ago

Hi @thejacer87 and thanks for reaching us. We tried to reproduce this problem and found out that it occurred in case trying to debug an Expo application using Debug Android scenario. There is Debug in Exponent scenario in the extension to debug such applications. Could you please try to launch Debug in Exponent scenario for debugging?

Seems that you have correct configuration for terminal, but for some reasons system graphical shell doesn't pick up PATH parameters. Could you please also try to do the following changes in ~/.bashrc and .~/.bash_profile files to provide correct PATH parameters to the graphical shell:

Also please make sure that ~/.profile contains something like this to forward all settings from ~/.bashrc :

if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

If there isn't such code in ~/.profile add it to this file:

  1. Run nano ~/.profile
  2. Add the code above and save the changes
  3. Run source ~/.profile
  4. Restart VS Code editor

Please let us know about your results.

thejacer87 commented 4 years ago

was able to get it running with debug in exponent. thanks. im just getting started with RN so didnt know there was a difference