Issue
Here's whats happening- react-native run-android fails giving the following error message- " Execution failed for task ':app:installDebug'.
com.android.builder.testing.api.DeviceException: No connected devices!
"
Here's a list of things i have done-
- Connected my phone (Redmi Note 7 pro) to the laptop (uses ubuntu 18.04) using a usb cable. And followed all instructions from the react-native documentation (USB debugging etc) but the device (phone) doesnt show on using the command
adb devices
. I have also tried connecting the phone as a file transfer device and every other mode possible. - I have tried connecting via the wifi network (which works) but the last time i did it i had to turn off MIUI optimisation, and this led to whatsapp going haywire and i had to reinstall whatsapp. From what i know this is a necessary condition, if wireless connection is to be made to an MI phone.
- Android emulator..... simply doesnt work (i have tried many SO tricks, none worked).
So is there a way to solve these issues? or is there any other method using which i can run my react-native application for debugging.
Thanks in advance :)
Solution
Ensure that Developer mode is enabled with USB debugging in the device. If USB debugging is enabled then the device id should be listed in the adb devices
list. If not then try to add ADB driver for the device or a universal ADB driver.
Answered By - Codemaker