2

At Android studio's terminal key in "./gradlew connectedVariantNameAndroidTest". Result with following error message:

Task :app:connectedDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:connectedDebugAndroidTest'.

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

Why?

Squall Huang
  • 647
  • 9
  • 20

1 Answers1

0

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

From error message, you should connect a device using usb or a virtual device.

CoXier
  • 2,523
  • 8
  • 33
  • 60
  • Thank you, CoXier.But how to connect a device? – Squall Huang May 19 '22 at 05:26
  • 1
    If you have Android device, you can use usb to connect pc and Android device. – CoXier May 19 '22 at 05:33
  • To CoXier. After connect to my real android mobile with android studio through wifi, "./gradlew connectedDebugAndroidTest" command success in android studio's terminal .But I would like to use this command on Jenkins later, how could I let Jenkins connect to Android real or virtual device??? – Squall Huang May 19 '22 at 06:49
  • 1
    You can use virtual device such as emulator on Jenkins. – CoXier May 19 '22 at 07:00