- React Native Tutorial
React-native run-android or react-native run-ios. Note: Watchman reset cache: If the above steps do not work, please. Sudo npm start - -reset-cache share improve this answer. Edited Mar 11 at 19:18. 17.3k 11 11 gold badges 47 47 silver badges 92 92 bronze badges. Answered Mar 11 at 16:19.
- Core Concepts
- Components and APIs
- React Native Useful Resources
- Selected Reading
We can run the React Native app on Android platform by running the following code in the terminal.
Before you can run your app on Android device, you need to enable USB Debugging inside the Developer Options.
When USB Debugging is enabled, you can plug in your device and run the code snippet given above.
The Native Android emulator is slow. We recommend downloading Genymotion for testing your app.
The developer menu can be accessed by pressing command + M.
Active3 months ago
I'd try to run
react-native run-android
but it always fails and appears error like this:JS server already running.Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
- What went wrong:Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().
- Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
- Get more help at https://help.gradle.org
BUILD FAILED in 0sCould not install the app on the device, read the error above for details.Make sure you have an Android emulator running or a device connected and haveset up your Android development environment:https://facebook.github.io/react-native/docs/getting-started.html
Command failed: ./gradlew installDebug
Error: Command failed: ./gradlew installDebug at checkExecSyncError (child_process.js:616:11) at Object.execFileSync (child_process.js:634:13) at runOnAllDevices (/Users/jworotikan/AwesomeProject/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19) at buildAndRun (/Users/jworotikan/AwesomeProject/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12) at isPackagerRunning.then.result (/Users/jworotikan/AwesomeProject/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12) at process._tickCallback (internal/process/next_tick.js:68:7)
Please Help me, how to solve this. I'm Using Mac and running Android Emulator from Android Studio.
4skm34skm3
2 Answers
As you're using Mac, then it may be a permission error.
try this on your project using a terminal:
Lucas DolsanLucas Dolsan
- Find the process: run:
ps aux | grep react-native
- Kill the process:
sudo kill -9 14492
(pid) - Run project
react-native run-android
orreact-native run-ios
Note: Watchman reset cache: If the above steps do not work, please
Scott17.3k1111 gold badges4848 silver badges9292 bronze badges
Jane AlamJane Alam