0

i have used linux mint and i got this message after start the native app. I have connected my android device to laptop. I am not using any simulator.

sudo react-native run-android

> Task :app:installDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
26 actionable tasks: 1 executed, 25 up-to-date

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 7s

error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

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 7s

    at checkExecSyncError (child_process.js:629:11)
    at execFileSync (child_process.js:647:13)
    at runOnAllDevices (/var/www/html/react/LotteryApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:75:39)
    at buildAndRun (/var/www/html/react/LotteryApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:137:41)
    at then.result (/var/www/html/react/LotteryApp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:103:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

I have tried many things like --warning-mode all and many other things. But i am still getting this error. I have no idea what to do.

I am using graddle version 5. npm - 6.9.0 node - 12.4.0 react-native-cli: 2.0.1 react-native: 0.60.0

can i get any clue that how to resolve this. Please help in this. Thanks in advance.

Ranjit
  • 1,684
  • 9
  • 29
  • 61
  • Possible duplicate of [com.android.builder.testing.api.DeviceException: No connected devices](https://stackoverflow.com/questions/48039119/com-android-builder-testing-api-deviceexception-no-connected-devices) – Michael Cheng Jul 05 '19 at 15:46

2 Answers2

0

The output tells you what the error is:

com.android.builder.testing.api.DeviceException: No connected devices!

You need to launch the Android simulator or connect a device to run the application on.

Michael Cheng
  • 9,644
  • 6
  • 46
  • 48
  • i have already connected my phone to my laptop. It was working yesterday. But not today after update npm. – Ranjit Jul 05 '19 at 15:46
  • Please edit your question to include that information. As it reads, it sounds like a duplicate. Also try rebooting your computer and/or opening a fresh terminal session. Please remember that the community at Stack Overflow expects questions with a [mcve] and that you have done your research in an effort to ask a good question (see: [ask]). – Michael Cheng Jul 05 '19 at 15:50
  • The edit I was referring to was to include that you updated npm which means: how did you update it? What version changes? etc. It may not matter, but it is useful information to differentiate the question. There is also an expectation of including the minimal debugging you've attempted so those trying to answer can reproduce the issue. For example, if you are 100% sure that your device is connected and working, it should show up if you type `adb devices`. What output do you get from that? – Michael Cheng Jul 05 '19 at 16:02
  • OMG! adb devices showing only List of devices attached. – Ranjit Jul 05 '19 at 16:06
  • So that means the error is exactly as stated. Notice how I correctly answered the question but that it doesn't help you solve your issue due to lack of information. This is a classic case of the [XY Problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) where your question and the solution do not align as you are asking the wrong question. Please read through that meta link and to learn how to avoid this. Please include more debugging information in your questions from now on. Otherwise users will not be able to help you. – Michael Cheng Jul 05 '19 at 16:18
  • Sorry, but it is still not showing my devices. But it is physically connected. – Ranjit Jul 06 '19 at 05:04
0

After reading through your discussion with Michael, seems like you might have to enable USB debugging in your android device.

Follow these steps, if dont see Developer Options in your device's Settings screen,

  1. Open the Settings app.
  2. (Only on Android 8.0 or higher) Select System.
  3. Scroll to the bottom and select About phone.
  4. Scroll to the bottom and tap Build number 7 times.
  5. Return to the previous screen to find Developer options near the bottom.

In your Developer Options enable the USB debugging option.

Now reconnect your device and it will ask you permission : Allow USB Debugging with your PC's MAC address. Click allow and then run

adb devices

You will see your device's ID in List of connected devices.

Nishant Nair
  • 1,837
  • 13
  • 19