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.