AnkushRasgon
AnkushRasgon

Reputation: 820

Error when I try to run react-native run-android command

C:\Users\hp\Desktop\Reactprojects\Makerobos>react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 855 file(s) to forward-jetify. Using 4 workers... info JS server already running. info Installing the app...

FAILURE: Build failed with an exception.

BUILD FAILED in 5s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

BUILD FAILED in 5s

at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\hp\Desktop\Reactprojects\Makerobos\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (C:\Users\hp\Desktop\Reactprojects\Makerobos\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\hp\Desktop\Reactprojects\Makerobos\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Command.handleAction (C:\Users\hp\Desktop\Reactprojects\Makerobos\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:160:7)

Upvotes: 0

Views: 5069

Answers (2)

Rahul Mishra
Rahul Mishra

Reputation: 4583

Your SDK path is not correct you need to add a correct path in the below file: sa project > android > local.properties

Add the path like below example:

sdk.dir = /Users/admin/Library/Android/sdk

After added use the following commands:

1. cd android/
2. ./gradlew clean
3. cd ..
4. Command: react-native bundle --platform android --dev false --entry-file indexcsasa.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
csacs
5. react-native run-android

Upvotes: 1

Gaurav Roy
Gaurav Roy

Reputation: 49

Sometimes the build fails, but it still runs .Have you tried connecting your app via the WIFI to the remote server? Check the connect via wifi method React connect via Wifi

I guess that will work

Upvotes: 0

Related Questions