Detox: Android app not opened in emulator due to childProcess.pid: undefined

Created on 1 Dec 2017  路  7Comments  路  Source: wix/Detox

Description

When running android ui tests with detox test command the android emulator is spun up but it does not open the app, seemingly due to this - detox verb Instrumentation spawned, childProcess.pid: undefined

Steps to Reproduce

Running detox test --configuration android.emu.debug --loglevel verbose

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 6.0.2
  • Node: 9.0.0
  • Device: Android Pixel API 27
  • Xcode: 9
  • macOS: 10.12.6

Device and verbose Detox logs

  • detox test --configuration android.emu.debug --loglevel verbose
  • tee /var/jenkins/workspace/act-native-appconfig_PR-123-HGVBDYGD4JOXXAWH43WZ4NIILUFSNMLMYZXKVPWF7KHDRXLBPERA/androidUiTestOutput.log
    node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration android.emu.debug --loglevel verbose
    detox-server info 09:12:04: server listening on localhost:56457...
    detox verb ws onOpen [object Object]
    detox verb ws send: {"type":"login","params":{"sessionId":"ecdbf8e7-9aac-366e-5f5e-a6187fcd5ece","role":"tester"},"messageId":0}
    detox verb ws onMessage: {"type":"loginSuccess","params":{"sessionId":"ecdbf8e7-9aac-366e-5f5e-a6187fcd5ece","role":"tester"},"messageId":0}
    detox verb ws
    detox verb 1: /Users/user/Library/Android/sdk/tools/emulator -list-avds --verbose
    detox verb 1: stdout: Pixel_API_25
    detox verb 1: stdout: Pixel_API_27
    detox verb 1: stdout:
    detox verb /Users/user/Library/Android/sdk/tools/emulator -verbose -gpu host -no-audio @Pixel_API_27
    (node:16308) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
    detox verb 2: /Users/user/Library/Android/sdk/platform-tools/adb devices
    detox verb 2: stdout: List of devices attached
    detox verb 2: stdout: emulator-5554 device
    detox verb 2: stdout:
    detox verb 2: stdout:
    detox verb 3: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop dev.bootcomplete
    detox verb 3: stdout:
    detox verb 3: stdout:
    detox verb 4: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop dev.bootcomplete
    detox verb 4: stdout:
    detox verb 4: stdout:
    detox verb 5: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop dev.bootcomplete
    detox verb 5: stdout:
    detox verb 5: stdout:
    detox verb 6: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop dev.bootcomplete
    detox verb 6: stdout:
    detox verb 6: stdout:
    detox verb 7: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop dev.bootcomplete
    detox verb 7: stdout:
    detox verb 7: stdout:
    detox verb 8: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop dev.bootcomplete
    detox verb 8: stdout:
    detox verb 8: stdout:
    detox verb 9: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop dev.bootcomplete
    detox verb 9: stdout:
    detox verb 9: stdout:
    detox verb 10: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop dev.bootcomplete
    detox verb 10: stdout:
    detox verb 10: stdout:
    detox verb 11: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop dev.bootcomplete
    detox verb 11: stdout: 1
    detox verb 11: stdout:
    detox verb 12: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell input keyevent 82
    detox verb 13: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall com.appconfigexample
    detox verb 13: stdout: Success
    detox verb 13: stdout:
    detox verb 14: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall com.appconfigexample.test
    detox verb 14: stdout: Success
    detox verb 14: stdout:
    detox verb 15: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /private/var/jenkins/workspace/act-native-appconfig_PR-123-HGVBDYGD4JOXXAWH43WZ4NIILUFSNMLMYZXKVPWF7KHDRXLBPERA/AppConfigExample/android/app/build/outputs/apk/app-debug.apk
    detox verb 15: stderr: Success
    detox verb 15: stderr:
    detox verb 16: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /private/var/jenkins/workspace/act-native-appconfig_PR-123-HGVBDYGD4JOXXAWH43WZ4NIILUFSNMLMYZXKVPWF7KHDRXLBPERA/AppConfigExample/android/app/build/outputs/apk/app-debug-androidTest.apk
    detox verb 16: stderr: Success
    detox verb 16: stderr:
    detox verb 17: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am force-stop com.appconfigexample
    detox verb adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:56457 -e detoxSessionId ecdbf8e7-9aac-366e-5f5e-a6187fcd5ece -e debug false com.appconfigexample.test/android.support.test.runner.AndroidJUnitRunner
    detox verb Instrumentation spawned, childProcess.pid: undefined
    detox verb ws send: {"type":"isReady","params":{},"messageId":-1000}
    child_process.js:614
    throw err;
    ^

Error: Command failed: node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration android.emu.debug --loglevel verbose
at checkExecSyncError (child_process.js:574:11)
at Object.execSync (child_process.js:611:13)
at runMocha (/private/var/jenkins/workspace/act-native-appconfig_PR-123-HGVBDYGD4JOXXAWH43WZ4NIILUFSNMLMYZXKVPWF7KHDRXLBPERA/AppConfigExample/node_modules/detox/local-cli/detox-test.js:61:6)
at Object. (/private/var/jenkins/workspace/act-native-appconfig_PR-123-HGVBDYGD4JOXXAWH43WZ4NIILUFSNMLMYZXKVPWF7KHDRXLBPERA/AppConfigExample/node_modules/detox/local-cli/detox-test.js:39:5)
at Module._compile (module.js:641:30)
at Object.Module._extensions..js (module.js:652:10)
at Module.load (module.js:560:32)
at tryModuleLoad (module.js:503:12)
at Function.Module._load (module.js:495:3)
at Function.Module.runMain (module.js:682:10)

acceptebug 馃彋 stale

Most helpful comment

I have this and it's sourced with my zshrc and it still cannot find my avd and it's still using the wrong path - version detox 6.0.4, gradle 2.4.1, react native 0.52.1. Detox build runs fine, but detox test errors

     ChildProcessError: Command failed: /usr/local/opt/android-sdk/tools/emulator -list-avds --verbose
/bin/sh: /usr/local/opt/android-sdk/tools/emulator: No such file or directory
 `/usr/local/opt/android-sdk/tools/emulator -list-avds --verbose` (exited with error code 127)

All 7 comments

At first I had only ANDROID_HOME set, but once I've added $ANDROID_HOME/platform-tools to the path I could get rid of this error.

I am having a similar error while Detox is trying to install the APK on the emulator

ChildProcessError: Command failed: /Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5556 install -r -g /Users/user/workspace/mobileTech/android/app/build/outputs/apk/debug/app-debug.apk adb: failed to install /Users/user/workspace/mobileTech/android/app/build/outputs/apk/debug/app-debug.apk: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI] ``/Users/user/Library/Android/sdk/platform-tools/adb -s emulator-5556 install -r -g /Users/user/workspace/mobileTech/android/app/build/outputs/apk/debug/app-debug.apk (exited with error code 1)

I have tried adding platform-tools to the path to no avail. Perhaps I am not doing it properly. If this is truly the solution I would appreciate a guide for doing this. Thanks.

@ararog anymore details on what you did?
I have this?
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH"

@evanjmg this line was more than enough to get detox started working for me.

I have this and it's sourced with my zshrc and it still cannot find my avd and it's still using the wrong path - version detox 6.0.4, gradle 2.4.1, react native 0.52.1. Detox build runs fine, but detox test errors

     ChildProcessError: Command failed: /usr/local/opt/android-sdk/tools/emulator -list-avds --verbose
/bin/sh: /usr/local/opt/android-sdk/tools/emulator: No such file or directory
 `/usr/local/opt/android-sdk/tools/emulator -list-avds --verbose` (exited with error code 127)

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions.

The issue has been closed for inactivity.

Was this page helpful?
0 / 5 - 0 ratings