Execution failed for task ‘:app:installDebug’ react native run android
Issue
When we tried to run the react native android app, the build was failing. The app was not starting giving the following error messages:
* What went wrong: Execution failed for task ':app:installDebug'. > com.android.builder.testing.api.DeviceException: No connected devices! BUILD FAILED in 1s 27 actionable tasks: 1 executed, 26 up-to-date 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
Reason
The reason of the issue mentioned on the error message. It said the emulator is either not running or not connected. We had a defafult android virtual device called Nexus 5X API 28 x86. We created our custom android virtual device called Pixel 2 API 27. But none of the virtual devices was started.
Solution
When we start the android virtual device Pixel 2 API 27 and then tried to run the react native android app ($ react-native run-android) the error was gone.