简体   繁体   中英

react-native - 'adb' is not recognized as an internal or external command

This is my first react native setup. I started to build with react-native run android and got BUILD SUCCESSFUL in 4m 7s message.

Then the CLI script tried:

info Connecting to the development server...

warn Failed to connect to development server using "adb reverse": spawnSync adb ENOENT
info Starting the app...

'adb' is not recognized as an internal or external command,
operable program or batch file.

error Failed to start the app.

Error: Command failed: adb shell am start -n com.notez/com.notez.MainActivity
at makeError (S:\Projects (my)\notez\node_modules\execa\index.js:174:9)  
    at Function.module.exports.sync (S:\Projects (my)\notez\node_modules\execa\index.js:338:15)

But I had settled everything up. ADB and SDK paths are defined in my OS ENV config.

So I tried to execute the failed code above on another console:

adb shell am start -n com.notez/com.notez.MainActivity

Then it worked? How can I define the 'adb' as an internal or external command as the error refers?

反应原生应用

I changed the enviroment variable ANDROID_HOME value from C:\Users\User\AppData\Local\Android\Sdk\ to C:\Users\User\AppData\Local\Android\Sdk\platform-tools\ and it worked...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM