Ash Archin
Ash Archin

Reputation: 451

Build successful but Failed to connect to development server using "adb reverse" spawnSync adb ENOENT

I'm new to reactNative, i set up my AwesomeApp then I tried to build it and see the result on my Xperia TX (Android 4.3) which is connect to my PC using USB (I cant use an emulator due to lack of VT-x support of my CPU). So I get Build Successful log but after I get the following:

BUILD SUCCESSFUL in 4m 59s
27 actionable tasks: 27 executed
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. Run CLI with --verbose flag for more details.
Error: Command failed: adb shell am start -n com.awesomeapp/com.awesomeapp.MainActivity
    at makeError (C:\Users\Programmer\Desktop\RasaHR\AwesomeApp\node_modules\execa\index.js:174:9)

I just saw the similar problem which is solved by changing node version to 10, but doesn't help for me. and also my AwesomeApp is installed on the phone but doesn't run automatically, when I open it it shows the following in a red box :

Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release

Upvotes: 2

Views: 8026

Answers (1)

Manasvi
Manasvi

Reputation: 530

Go to the terminal > navigate to project... run the following commands:-

adb reverse tcp:8081 tcp:8081

close the visual studio, then reopen

npx react-native run-android...

works fine in windows, but make sure sdk path is defined in env.

ANDROID_HOME=c:/Users/USER/AppData/Local/Android/Sdk

path = c:/Users/USER/AppData/Local/Android/Sdk/platform-tools

Upvotes: 2

Related Questions