0

There are quite a few online posts about the error. My situation is that I can make the connection sometimes but failed most of times. Here is the error when failing:

PS C:\d\code\js\chatapp> react-native run-android
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!

* 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 15s
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
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

Here is the message when success:

PS C:\d\code\js\chatapp> react-native run-android
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...

> Task :app:installDebug
Installing APK 'app-debug.apk' on 'MHA-L29 - 8.0.0' for app:debug
Installed on 1 device.


BUILD SUCCESSFUL in 6s
27 actionable tasks: 1 executed, 26 up-to-date
'adb' is not recognized as an internal or external command,
operable program or batch file.
Starting the app (c:\AppData\Local\Android\Sdk/platform-tools/adb shell am start -n com.chatapp/com.chatapp.MainActivity...
Starting: Intent { cmp=com.chatapp/.MainActivity }

I don't have good explanation why sometime it did work and other time it did not. Before each react-native run andrioid, USB Debugging is enabled on Mate 9.

user938363
  • 9,990
  • 38
  • 137
  • 303
  • 1
    this can happen if your device is not connected properly, But when I get this error I solve it by checking following conditions: 1: if you are using USB debugging. => See if your USB cable connected properly 2: If you are using IP addredds => then check if IP address is correct and also your device and machine on same network. Hope this works. – Pradnya Choudhari Jan 24 '19 at 14:50

4 Answers4

1

This would also happen to me when the phone I had connected had a locked screen. Make sure the phone is 'active' when you're trying to run. Before you run react-native run-android you can use "adb devices" command to list all connected devices. Make sure there is only one at time (no emulator running as well). Last thing I can recommend is update React Native. They are doing a great job improving with each version and it might happen you will never see this error again in the newest version. Good luck!

Annie Hill
  • 379
  • 3
  • 16
1

I had a similar issue and just posted a solution that worked for me here - https://stackoverflow.com/a/67566428/10392546

I ran into a similar issue, not sure if you get it fixed, but I came accross this post when looking for solutions and the above solution didn't work for me.

A solution I did find out about was to install android-emulator-m1-preview from google, launch that instead of launching the emulator from inside Android Studio. Its almost annoying how simple of an issue it turned out to be to fix.

Seeing build successful after 12+ hours of trying different solutions is really nice.

Austin
  • 53
  • 6
0

I have this issue with my project. I have tried many ways to solve that and I have so many guidelines in stackoverflow, github, blog articles. But there was a mistake I made within the process. So make sure you are do things withing the debugging period.

  1. runcd android && ./gradlew clean && ./gradlew :app:bundleRelease

  2. make sure in each action wipe data in emulator

  3. If you are trying with the external device make sure it is online or unlock the screen.

0

Try uninstalling the package from your phone. Sometimes this data is cached in your phone memory. You can use the following commands.

  1. List adb devices connected to your computer. Head over to the terminal in your the project root directory and run adb devices. This will list all the devices attached. Your result will look something like this;

$ adb devices List of devices attached 047292599G105335 device
  1. Then run adb -s <your_device_key> uninstall <your_package_name>. <your_device_key> in this case is is 047292599G105335 and the package name looks something like com.appname, all without the square brackets.

    So in my case it looked like adb -s 047292599G105335 uninstall com.appname

  2. Now run your project again react-native run-android

Edgar256
  • 702
  • 9
  • 13