Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to Genymotion emulator #386

Closed
vasyas opened this issue Nov 6, 2017 · 6 comments
Closed

Unable to connect to Genymotion emulator #386

vasyas opened this issue Nov 6, 2017 · 6 comments

Comments

@vasyas
Copy link
Contributor

vasyas commented Nov 6, 2017

Description

Unable to connect to Genymotion emulator. Stock Android emulator works ok.
Deployment to Genymotion using react-native works also ok.

Error when running Detox:

~/workspace/crg/tests> mocha native --opts native/mocha.opts --configuration android.emu.debug --reuse --loglevel verbose


detox info 10:24:15: server listening on localhost:58283...
detox verb ws onOpen [object Object]
detox verb ws send: {"type":"login","params":{"sessionId":"ff60085d-e041-8510-063d-ba1e880e99e8","role":"tester"},"messageId":0}
detox verb ws onMessage: {"type":"loginSuccess","params":{"sessionId":"ff60085d-e041-8510-063d-ba1e880e99e8","role":"tester"},"messageId":0}
detox verb ws
detox verb 1: /Users/vasyas/Library/Android/sdk/tools/emulator -list-avds --verbose
detox verb 1: stdout: Nexus_5X_API_25_x86
detox verb 1: stdout:
  1) "before all" hook

  0 passing (141ms)
  1 failing

  1)  "before all" hook:
     Error: Can not boot Android Emulator with the name: '192.168.57.101:5555',
      make sure you choose one of the available emulators: Nexus_5X_API_25_x86
      at EmulatorDriver._callee3$ (node_modules/detox/lib/devices/EmulatorDriver.js:35:19)
      at tryCatch (/Users/vasyas/.config/yarn/global/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40)
      at Generator.invoke [as _invoke] (/Users/vasyas/.config/yarn/global/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:303:22)
      at Generator.prototype.(anonymous function) [as next] (/Users/vasyas/.config/yarn/global/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:117:21)
      at step (node_modules/detox/lib/devices/EmulatorDriver.js:1:747)
      at node_modules/detox/lib/devices/EmulatorDriver.js:1:907
      at <anonymous>
      at process._tickDomainCallback (internal/process/next_tick.js:228:7)

Running Genymotion:

~/workspace/crg/tests> adb devices -l
List of devices attached
192.168.57.101:5555    device product:vbox86p model:Google_Nexus_5X___7_1_0___API_25___1080x1920 device:vbox86p

Detox config:

      "android.emu.debug": {
        "binaryPath": "../native/android/app/build/outputs/apk/app-debug.apk",
        "build": "pushd ../native/android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && popd",
        "type": "android.emulator",
        "name": "192.168.57.101:5555"
      }

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 5.9.2
  • Node: 8.8.1
  • Device: Genymotion Android 7.1
  • macOS: 10.13
@kagalenitin
Copy link

Per this page, https://github.com/wix/detox/blob/master/docs/More.AndroidSupportStatus.md - Genymotion support is not there yet - it says 'coming a bit later'

@vasyas
Copy link
Contributor Author

vasyas commented Nov 9, 2017

I was able to connect to Genymotion emu. But during test launch I got message 'INSTRUMENTATION_FAILED':

detox info 17:13:12: server listening on localhost:58620...
detox verb ws onOpen [object Object]
detox verb ws send: {"type":"login","params":{"sessionId":"f56ddfe1-fefd-021d-dbed-d8fc2ad5926c","role":"tester"},"messageId":0}
detox verb ws onMessage: {"type":"loginSuccess","params":{"sessionId":"f56ddfe1-fefd-021d-dbed-d8fc2ad5926c","role":"tester"},"messageId":0}
detox verb ws
detox verb 1: /Users/vasyas/Library/Android/sdk/tools/emulator -list-avds --verbose
detox verb 1: stdout: Nexus_5X_API_25_x86
detox verb 1: stdout:
detox verb 2: /Users/vasyas/Library/Android/sdk/platform-tools/adb  devices
detox verb 2: stdout: List of devices attached
detox verb 2: stdout: 192.168.57.101:5555	device
detox verb 2: stdout:
detox verb 2: stdout:
detox verb 3: /Users/vasyas/Library/Android/sdk/platform-tools/adb -s 192.168.57.101:5555 shell input keyevent 82
detox verb 4: /Users/vasyas/Library/Android/sdk/platform-tools/adb -s 192.168.57.101:5555 shell am force-stop com.crg_mobile
detox verb adb -s 192.168.57.101:5555 shell am instrument -w -r -e detoxServer ws://localhost:58620 -e detoxSessionId f56ddfe1-fefd-021d-dbed-d8fc2ad5926c -e debug false com.crg_mobile.test/android.support.test.runner.AndroidJUnitRunner
detox verb Instrumentation spawned, childProcess.pid:  3715
detox verb ws send: {"type":"isReady","params":{},"messageId":-1000}
detox verb Instrumentation stderr:  android.util.AndroidException: INSTRUMENTATION_FAILED: com.crg_mobile.test/android.support.test.runner.AndroidJUnitRunner
detox verb Instrumentation stderr:
detox verb Instrumentation stderr:  	at com.android.commands.am.Am.runInstrument(Am.java:890)
detox verb Instrumentation stderr:  	at com.android.commands.am.Am.onRun(Am.java:400)
detox verb Instrumentation stderr:
detox verb Instrumentation stderr:  	at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
detox verb Instrumentation stderr:  	at com.android.commands.am.Am.main(Am.java:121)
detox verb Instrumentation stderr:  	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
detox verb Instrumentation stderr:  	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)
detox verb Instrumentation stderr:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: id=ActivityManagerService
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.crg_mobile.test/android.support.test.runner.AndroidJUnitRunner}
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS_CODE: -1
detox verb Instrumentation stdout:
detox verb instrumentationProcess terminated due to receipt of signal null
  1) "before all" hook

@vasyas vasyas mentioned this issue Nov 9, 2017
@simonracz
Copy link
Contributor

simonracz commented Nov 9, 2017

Hey @vasyas ,

I honestly don't know how you reached this state with existing commands. :)

But, now that you reached it, my guess what's missing for you is that the test.apk is not installed on the device.
For an instrumentation test on Android you have to have two apks, one is the real app, the other one is the test app, which holds your instrumentation tests.

Run this one adb shell pm list instrumentation to see whether your test apk is installed or not.

@vasyas
Copy link
Contributor Author

vasyas commented Nov 9, 2017

@simonracz thanks.
Created PR #397

@rotemmiz
Copy link
Member

Thanks for the PR, I'd like to merge it, please read the notes.
Proper Genymotion support would include a wrapper around gmtool , but this is only available for paying Genymotion users.

@rotemmiz
Copy link
Member

Merged #397

@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants