Reputation: 21
I am trying to run my react project for my android phone . But when typing this command react-native run-android
This error appears:
FAILURE: Build failed with an exception.
What went wrong:
* Try:
Run with --stacktrace option
to get the stack trace. Run with --info
or --debug option
to get more log output.
Could 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 have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Any help please.
Upvotes: 2
Views: 62
Reputation: 1143
It literally means what it says, you don't have an emulator running or a device configured in debug/development mode connected to your computer.
run the following (assuming you have the android tools setup correctly, look here for instructions on how to do this: https://developer.android.com/studio/command-line/adb)
adb devices
if you get the following:
List of devices attached
If there's nothing listed then you either need to start an emulator using Android Studio, command line or something like https://www.genymotion.com/.
if you're trying to connect to your Android device via USB then you need to check the version of Android you are using and enable development mode via USB in your device's settings.
here's some docs on how to enable your device for development: https://developer.android.com/studio/debug/dev-options
Once you have an emulator or device configured and attached you can run:
adb devices
If everything is working correctly you should see a list of device(s) available.
react-native run-android
Should now work as expected.
Upvotes: 1