admin管理员组

文章数量:1336710

Following the react native documentation, i just created my first react-native app (just npx react-native init AwesomeProject no changes).I also added the enviromentalpath: C:\Users\thijs\AppData\Local\Android\Sdk\platform-tools named ANDROID_HOME under uservariables. But when i try to run my code i get an error

    Stack: Error: Failed to run the application in Android (error code 104): 
    Error while executing mand 'adb devices': Command failed: adb devices
    'adb' is not recognized as an internal or external mand,
    operable program or batch file.

    at Function.getWrappedError (c:\Users\thijs\.vscode\extensions\msjsdiag.vscode-react-native-1.4.1\dist\rn-extension.js:1:152489)
at Function.wrapError (c:\Users\thijs\.vscode\extensions\msjsdiag.vscode-react-native-1.4.1\dist\rn-extension.js:1:13533)
at c:\Users\thijs\.vscode\extensions\msjsdiag.vscode-react-native-1.4.1\dist\rn-extension.js:1:203519
at processTicksAndRejections (internal/process/task_queues.js:97:5)

When i open cmd and go to the exact location where adb.exe is installed adb device works but when in do it in any other location it won't work

I've tried reinstalling android studio... No results. I've looked at other stackoverflow questions but no one seemed to have the exact same error as mine(i tried they're sollutions but no results).

This is my first time posting here if you need any additional information please ask. Thanks in advance.

Following the react native documentation, i just created my first react-native app (just npx react-native init AwesomeProject no changes).I also added the enviromentalpath: C:\Users\thijs\AppData\Local\Android\Sdk\platform-tools named ANDROID_HOME under uservariables. But when i try to run my code i get an error

    Stack: Error: Failed to run the application in Android (error code 104): 
    Error while executing mand 'adb devices': Command failed: adb devices
    'adb' is not recognized as an internal or external mand,
    operable program or batch file.

    at Function.getWrappedError (c:\Users\thijs\.vscode\extensions\msjsdiag.vscode-react-native-1.4.1\dist\rn-extension.js:1:152489)
at Function.wrapError (c:\Users\thijs\.vscode\extensions\msjsdiag.vscode-react-native-1.4.1\dist\rn-extension.js:1:13533)
at c:\Users\thijs\.vscode\extensions\msjsdiag.vscode-react-native-1.4.1\dist\rn-extension.js:1:203519
at processTicksAndRejections (internal/process/task_queues.js:97:5)

When i open cmd and go to the exact location where adb.exe is installed adb device works but when in do it in any other location it won't work

I've tried reinstalling android studio... No results. I've looked at other stackoverflow questions but no one seemed to have the exact same error as mine(i tried they're sollutions but no results).

This is my first time posting here if you need any additional information please ask. Thanks in advance.

Share Improve this question edited Apr 13, 2021 at 12:43 Eeplo asked Apr 13, 2021 at 10:05 EeploEeplo 351 gold badge1 silver badge5 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

The environment variables gets populated on process start-up, so you just have to restart the terminal (e.g. mand prompt) after you modified the environment variables.

If you are using IDE such as Visual Studio Code, sometimes the terminal session get restored even you restarted. So you might have to kill the terminal too.

If this still not working, just restart your PC.

You need to add the adb path in Environment Variable path

In your Dir Where Adb is located copy the path

Now add this copied path to the end of PATH of environment variables[System > Advanced System Settings > Environment Variables...

In this Environment Variables window, in the User variables for (your-username) highlight Path and click Edit...] or by

set PATH=%PATH%;your adb folder path

ex - set PATH "%PATH%;C:\Program Files\android-sdk-windows\platform-tools" be careful the path that you want to add if it contains double quote

Try to set your environment variable as per the location of platform-tools

You can find adb in "ADT Bundle/sdk/platform-tools" Set the path and restart the cmd and then try again.

本文标签: javascriptError while executing command 39adb devices39 visual studio codeStack Overflow