Detox pointing to wrong sdk/emulator location

986 views Asked by At

Basically all is configured ok, detox build is successful. When i try to run detox, somehow [exec.js/EXEC_CMD, #0] "/usr/local/bin/emulator" is pointing to a wrong location of emulator. In bash_profile all is set ok (echo, other commands are working).

On my other laptop it's working: detox[26099] DEBUG: [exec.js/EXEC_CMD, #0] "/Users/admin/Library/Android/sdk/emulator/emulator" -list-avds --verbose

Any hints?

"detox": "^17.6.0", "react-native": "~0.62.2",

EN610483:da-paperround sebastianRad$ 
EN610483:da-paperround sebastianRad$ detox test --configuration android.emu.debug2 --loglevel trace
detox[8613] INFO:  [test.js] configuration="android.emu.debug2" loglevel="trace" useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1601579145011 readOnlyEmu=false reportSpecs=true jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' --maxWorkers 1 e2e
detox[8615] TRACE: [Detox.js/DETOX_CREATE] created a Detox instance with config:
{"artifactsConfig":{"rootDir":"artifacts/android.emu.debug2.2020-10-01 19-05-45Z","plugins":{"log":{"enabled":false,"keepOnlyFailedTestsArtifacts":false},"screenshot":{"enabled":true,"shouldTakeAutomaticSnapshots":false,"keepOnlyFailedTestsArtifacts":false},"video":{"enabled":false,"keepOnlyFailedTestsArtifacts":false},"instruments":{"enabled":false,"keepOnlyFailedTestsArtifacts":false},"timeline":{"enabled":false}},"pathBuilder":{"_rootDir":"artifacts/android.emu.debug2.2020-10-01 19-05-45Z"}},"behaviorConfig":{"init":{"reinstallApp":true,"exposeGlobals":true,"launchApp":true},"cleanup":{"shutdownDevice":false}},"cliConfig":{"configuration":"android.emu.debug2","forceAdbInstall":"false","loglevel":"trace","useCustomLogger":"true"},"deviceConfig":{"binaryPath":"android/app/build/outputs/apk/debug/app-debug.apk","build":"cd android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug && cd ..","type":"android.emulator","device":{"avdName":"Pixel_API_28_AOSP2"}},"runnerConfig":{"testRunner":"jest","runnerConfig":"e2e/config.json","specs":"e2e"},"sessionConfig":{"autoStart":true,"server":"ws://localhost:50372","sessionId":"03b67aba-fa64-bb02-961c-60c5335e4baf"},"errorBuilder":{"filepath":"/Users/sebastianRad/project/da-paperround/.detoxrc.json","contents":{"testRunner":"jest","runnerConfig":"e2e/config.json","configurations":{"ios.sim.debug":{"binaryPath":"ios/build/Build/Products/Debug-iphonesimulator/paperrround.app","build":"xcodebuild -workspace ios/paperrround.xcworkspace -scheme paperrround -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 11' -derivedDataPath ios/build","type":"ios.simulator","name":"iPhone 11","os":"13.0"},"ios.sim.debug2":{"binaryPath":"ios/build/Build/Products/Debug-iphonesimulator/paperrround.app","build":"xcodebuild -workspace ios/paperrround.xcworkspace -scheme paperrround -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 11 Pro' -derivedDataPath ios/build","type":"ios.simulator","name":"iPhone 11 Pro","os":"13.0"},"ios.sim.debug3":{"binaryPath":"ios/build/Build/Products/Debug-iphonesimulator/paperrround.app","build":"xcodebuild -workspace ios/paperrround.xcworkspace -scheme paperrround -configuration Debug -destination 'platform=iOS Simulator,name=iPhone SE' -derivedDataPath ios/build","type":"ios.simulator","name":"iPhone SE"},"android.emu.debug":{"binaryPath":"android/app/build/outputs/apk/debug/app-debug.apk","build":"cd android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug && cd ..","type":"android.emulator","device":{"avdName":"Pixel_API_28_AOSP2"}},"android.emu.debug2":{"binaryPath":"android/app/build/outputs/apk/debug/app-debug.apk","build":"cd android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug && cd ..","type":"android.emulator","device":{"avdName":"Pixel_API_28_AOSP2"}}}},"configurationName":"android.emu.debug2"}}
detox[8615] INFO:  [DetoxServer.js] server listening on localhost:50372...
detox[8615] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:50372
detox[8615] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"03b67aba-fa64-bb02-961c-60c5335e4baf","role":"tester"},"messageId":0}
detox[8615] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=03b67aba-fa64-bb02-961c-60c5335e4baf
detox[8615] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=03b67aba-fa64-bb02-961c-60c5335e4baf
detox[8615] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"03b67aba-fa64-bb02-961c-60c5335e4baf","role":"tester"},"messageId":0}
 
detox[8615] DEBUG: [exec.js/EXEC_CMD, #0] "/usr/local/bin/emulator" -list-avds --verbose
detox[8615] TRACE: [exec.js/EXEC_SUCCESS, #0] Pixel_API_28_AOSP2

 

detox[8615] DEBUG: [exec.js/EXEC_CMD, #1] "/usr/local/bin/emulator" -version

detox[9204] DEBUG: [exec.js/EXEC_CMD, #1] "/usr/local/bin/emulator" -version
detox[9204] ERROR: [exec.js/EXEC_FAIL, #1] ""/usr/local/bin/emulator" -version" failed with code = 2, stdout and stderr:

 

detox[9204] ERROR: [exec.js/EXEC_FAIL, #1] 
detox[9204] ERROR: [exec.js/EXEC_FAIL, #1] [4607778240]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at /usr/local/emulator/lib64/qt/lib
Could not launch '/usr/local/emulator/qemu/darwin-x86_64/qemu-system-i386': No such file or directory

 

detox[9204] ERROR: [EmulatorVersionResolver.js/EMU_BIN_VERSION_DETECT] Could not detect emulator binary version ChildProcessError: Command failed: "/usr/local/bin/emulator" -version
[4607778240]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at /usr/local/emulator/lib64/qt/lib
Could not launch '/usr/local/emulator/qemu/darwin-x86_64/qemu-system-i386': No such file or directory
 `"/usr/local/bin/emulator" -version` (exited with error code 2)
    at callback (/Users/sebastianRad/project/da-paperround/node_modules/child-process-promise/lib/index.js:33:27)
    at ChildProcess.exithandler (child_process.js:315:5)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1047:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
  code: 2,
  childProcess: {
    _forkChild: [Function: _forkChild],
    ChildProcess: [Function: ChildProcess],
    exec: [Function: exec],
    execFile: [Function: execFile],
    execFileSync: [Function: execFileSync],
    execSync: [Function: execSync],
    fork: [Function: fork],
    spawn: [Function: spawn],
    spawnSync: [Function: spawnSync]
  },
  stdout: '',
  stderr: '[4607778240]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at /usr/local/emulator/lib64/qt/lib\n' +
    "Could not launch '/usr/local/emulator/qemu/darwin-x86_64/qemu-system-i386': No such file or directory\n"
}
detox[9204] WARN:  [AVDValidator.js/AVD_VALIDATION] Emulator version detection failed (See previous logs)
detox[9204] DEBUG: [exec.js/EXEC_CMD, #2] "/usr/local/bin/emulator" -version
1

There are 1 answers

0
maiky On

worked after path to emulator was sent manually and not using android_home or android_sdk_root. some hints here: https://medium.com/@wnyao0830/run-create-react-native-app-on-android-studios-emulator-ad678a0c362f#:~:text=Here%20i%20will%20step%20through,your%20emulator%20to%20run%20with.