Vscode-react-native: [Bug] If there is a space in the ADB path, it will not work properly

Created on 22 Jun 2020  ·  5Comments  ·  Source: microsoft/vscode-react-native

1.

set .zshrc
PATH="${PATH}":"/Volumes/Macintosh HD/Users/foo/Library/Android/sdk/platform-tools"

2.
Run Debug Android

Debug output


Debug Console

デバッグできませんでした。コマンド '/Volumes/Macintosh HD/Users/foo/Library/Android/sdk/platform-tools/adb devices' の実行中にエラーが発生しました : Command failed: /Volumes/Macintosh HD/Users/foo/Library/Android/sdk/platform-tools/adb devices
/bin/sh: /Volumes/Macintosh: No such file or directory```

Environment

  • React Native Tools extension version: 0.16.0
bug fix-in-master triaged

Most helpful comment

@yuki2006 We fixed that situation and now path acquired from sdk.dir will be enclosed in quotation marks when executing any command. This should help to avoid such situations in future. This fix will be available in the next extension release.

All 5 comments

Hi @yuki2006 and thanks for your question. It is no need to go down to level of mounted drives to set the path to the Android SDK. You can try to do it using the following recommendations:
Could you please try to replace your current content of .zshrc by these lines?

export ANDROID_HOME=/Users/$USER/Library/Android/sdk/
export ANDROID_SDK_ROOT=$ANDROID_HOME
PATH="$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"

Please let us know if this helped.

Thank you @SounD120 .

Probably it's okay, but
I'm working with the ADB on a different drive due to less storage..

@yuki2006, I tried to modify my .zshrc file the following way:

PATH="$PATH:/Volumes/Macintosh HD/Users/user/Documents/temp_sdk/folder with space/sdk/platform-tools"
export ANDROID_HOME=/Users/user/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin

And the adb devices command worked correctly in the extension.

Could you please also try to add backslash(\) before the space in your configuration string to wrap the space?

set .zshrc
PATH="${PATH}":"/Volumes/Macintosh\ HD/Users/foo/Library/Android/sdk/platform-tools"

Sorry @RedMickey

I checked again.
The project included local.properties (generated by Android Studio).
sdk.dir was written there.

sdk.dir=/Volumes/Macintosh HD/Users/foo/Library/Android/sdk

The extension did not work properly under these conditions.

PATH was not the cause..

By doing this, it works properly.

sdk.dir=/Volumes/Macintosh\ HD/Users/foo/Library/Android/sdk

Since it is an error display in Android Studio, I thought it would be better to support it with extension.

@yuki2006 We fixed that situation and now path acquired from sdk.dir will be enclosed in quotation marks when executing any command. This should help to avoid such situations in future. This fix will be available in the next extension release.

Was this page helpful?
0 / 5 - 0 ratings