Detox: Could not find 'undefined' on the currently ADB attached devices: issue even though the device is connected

Created on 28 Nov 2019  路  5Comments  路  Source: wix/Detox

I have created Detox setup in Ubuntu 18.04 .Currently the build is happening fine with the command detox build but while running the detox test command i am getting following error.

Running command
detox build -c android.emu.debug && detox test -c android.emu.debug

The physical device is connected and when i execute adb devices command i could see result as

* daemon started successfully
56149225    device
Environment - Detox: 14.8.3 - React Native:0.60.6 - Node:v12.13.1 - Device: Redmi 6A & android emulator - OS: Android Error
detox[31773] INFO:  [DetoxServer.js] server listening on localhost:40969...
detox[31773] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR] 
 DetoxRuntimeError: DetoxRuntimeError: Could not find 'undefined' on the currently ADB attached devices:

HINT: Make sure your device is connected.
You can also try restarting adb with 'adb kill-server && adb start-server'.

List of devices attached
56149225   device


    at AttachedAndroidDriver.acquireFreeDevice (/home/mahadev/Documents/Detox/examples/demo-react-native/node_modules/detox/src/devices/drivers/AttachedAndroidDriver.js:21:13)
    at async Device.prepare (/home/mahadev/Documents/Detox/examples/demo-react-native/node_modules/detox/src/devices/Device.js:20:22)
    at async Detox.init (/home/mahadev/Documents/Detox/examples/demo-react-native/node_modules/detox/src/Detox.js:72:5)
    at async Function._initializeInstance (/home/mahadev/Documents/Detox/examples/demo-react-native/node_modules/detox/src/DetoxExportWrapper.js:81:7)
    at async DetoxExportWrapper.init (/home/mahadev/Documents/Detox/examples/demo-react-native/node_modules/detox/src/DetoxExportWrapper.js:32:20)
    at async Context.<anonymous> (/home/mahadev/Documents/Detox/examples/demo-react-native/e2e/init.js:6:3)
  1) "before all" hook in "{root}"

  0 passing (34ms)
  1 failing

  1) "before all" hook in "{root}":
     Error: DetoxRuntimeError: Could not find 'undefined' on the currently ADB attached devices:

HINT: Make sure your device is connected.
You can also try restarting adb with 'adb kill-server && adb start-server'.

List of devices attached
56149225   device


      at AttachedAndroidDriver.acquireFreeDevice (node_modules/detox/src/devices/drivers/AttachedAndroidDriver.js:21:13)
      at async Device.prepare (node_modules/detox/src/devices/Device.js:20:22)
      at async Detox.init (node_modules/detox/src/Detox.js:72:5)
      at async Function._initializeInstance (node_modules/detox/src/DetoxExportWrapper.js:81:7)
      at async DetoxExportWrapper.init (node_modules/detox/src/DetoxExportWrapper.js:32:20)
      at async Context.<anonymous> (e2e/init.js:6:3)



detox[31765] ERROR: [cli.js] Error: Command failed: node_modules/.bin/mocha --opts e2e/mocha.opts --configuration android.emu.debug --grep :ios: --invert "e2e"

Package.json file

"detox": {
    "test-runner": "mocha",
    "runner-config": "e2e/mocha.opts",
    "configurations": {
      "ios.sim.release": {
        "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/example.app",
        "build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -project ios/example.xcodeproj -UseNewBuildSystem=NO -scheme example -configuration Release -sdk iphonesimulator -derivedDataPath ios/build -quiet",
        "type": "ios.simulator",
        "device": {
          "type": "iPhone 11 Pro"
        }
      },
      "ios.sim.debug": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
        "build": "xcodebuild -project ios/example.xcodeproj -UseNewBuildSystem=NO -scheme example -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.simulator",
        "device": {
          "type": "iPhone 11 Pro"
        }
      },
      "ios.none": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
        "build": "xcodebuild -project ios/example.xcodeproj -UseNewBuildSystem=NO -scheme example -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.none",
        "device": {
          "type": "iPhone 11 Pro"
        },
        "session": {
          "server": "ws://localhost:8099",
          "sessionId": "com.wix.demo.react.native"
        }
      },
      "android.emu.debug": {
        "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
        "build": "cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -",
        "type": "android.attached",
        "device": {
          "avdName": "56149225"
        }
      },
      "android.emu.release": {
        "binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
        "build": "cd android ; ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release ; cd -",
        "type": "android.attached",
        "device": {
          "avdName": "56149225"
        }
      }
    }
  }
triagenhancement more info needed android

Most helpful comment

was currently struggling with the same issue:
If it's a connected device then you need to use adbName instead of avdName in the device config.

edit: docu is lacking that information

All 5 comments

was currently struggling with the same issue:
If it's a connected device then you need to use adbName instead of avdName in the device config.

edit: docu is lacking that information

Any actual suggestions, guys?
What a dream product would do in your situations to help you figure out what's wrong?
@MahadevG , @chriswiesner , @Rubenvdveen, @fralyx?

Currently, the formulation of the issue does not suggest any development vector, just a yelp for a help, so to say.

@noomorph Maybe add it to the hint in the error message? Or just create a general name for both configurations?
I used these docs for Android setup: https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md#5-add-android-configuration
There is no example of "adbName". It states this:

android.attached. Connect to already-attached android device. The device should be listed in the output of adb devices command under provided name. Use this type to connect to Genymotion emulator.

Which does not tell me to change the device configuration to "adbName" instead of "avdName"

This issue has been automatically closed because there has been no response to our request for more information from the original author.

For more information on bots in this reporsitory, read this discussion.

Was this page helpful?
0 / 5 - 0 ratings