Detox tests don't run in Android release mode - React Native 0.59

Created on 14 Jun 2019  路  28Comments  路  Source: wix/Detox

Describe the bug
Detox does not run test in Android release mode. Latest versions of both Detox + React Native. The test will hang until it hits the jest timeout and then fail.

To Reproduce
Create a clean install of the latest react native. Set up detox. Everything works except for release mode in Android. See example repo where issue is reproduced:
https://github.com/jasonhealy/react-native-detox

  • [x] I have tested this issue on the latest Detox release and it still reproduces

Expected behavior
The tests should run in android release mode.

Environment (please complete the following information):

  • Detox: 12.11.0
  • React Native: 0.59.9
  • Node: 8.11.4
  • Device: Android Stock Emulator
  • OS: MacOS

Device and Verbose Detox Logs

detox[89662] INFO:  [DetoxServer.js] server listening on localhost:49694...
detox[89662] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:49694
detox[89662] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"67ad6740-d299-f127-cdf7-72d96
443097a","role":"tester"},"messageId":0}
detox[89662] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=67ad6740-d299-f127-cdf7-72d96443097a
detox[89662] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=67ad6740-d299-f127-cdf7-72d96443097a
detox[89662] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"67ad6740-d299-f127-
cdf7-72d96443097a","role":"tester"},"messageId":0}

detox[89662] DEBUG: [exec.js/EXEC_CMD, #0] /Users/jason/Library/Android/sdk/emulator/emulator -list-avds --verbose
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #0] DETOX_EMU_API_28
DEV_API_28
Pixel_XL_API_28

detox[89662] DEBUG: [exec.js/EXEC_CMD, #1] /Users/jason/Library/Android/sdk/platform-tools/adb  devices
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #1] List of devices attached
emulator-5554   device


detox[89662] TRACE: [EmulatorTelnet.js/TELNET_CONNECTING] port: 5554, host: localhost
detox[89662] DEBUG: [exec.js/EXEC_CMD, #2] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "getp
rop dev.bootcomplete"
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #2] 1

detox[89662] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBootDevice({ coldBoot: false, deviceId: 'emulator-55
54' })
detox[89662] DEBUG: [exec.js/EXEC_CMD, #3] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "getp
rop ro.build.version.sdk"
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #3] 28

detox[89662] DEBUG: [exec.js/EXEC_CMD, #4] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "dump
sys power | grep \"^[ ]*m[UW].*=\""
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #4]   mWakefulness=Awake
  mWakefulnessChanging=false
  mWakeLockSummary=0x0
  mUserActivitySummary=0x4
  mWakeUpWhenPluggedOrUnpluggedConfig=false
  mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig=false
  mUserActivityTimeoutOverrideFromWindowManager=-1
  mUserInactiveOverrideFromWindowManager=false

detox[89662] DEBUG: [exec.js/EXEC_CMD, #5] /Users/jason/Library/Android/sdk/build-tools/29.0.0-rc1/aapt dump badging "/User
s/jason/Code/RNDetox/android/app/build/outputs/apk/release/app-release.apk" | grep -e "package: name="
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #5] package: name='com.rndetox' versionCode='1' versionName='1.0' compileSdkVers
ion='28' compileSdkVersionCodename='9'

detox[89662] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeUninstallApp({ deviceId: 'emulator-5554', bund
leId: 'com.rndetox' })
detox[89662] DEBUG: [exec.js/EXEC_CMD, #6] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "pm l
ist packages com.rndetox"
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #6] package:com.rndetox
package:com.rndetox.test

detox[89662] DEBUG: [exec.js/EXEC_CMD, #7] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall c
om.rndetox
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #7] Success

detox[89662] DEBUG: [exec.js/EXEC_CMD, #8] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "pm l
ist packages com.rndetox.test"
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #8] package:com.rndetox.test

detox[89662] DEBUG: [exec.js/EXEC_CMD, #9] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall c
om.rndetox.test
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #9] Success

detox[89662] DEBUG: [exec.js/EXEC_CMD, #10] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r
 -g -t "/Users/jason/Code/RNDetox/android/app/build/outputs/apk/release/app-release.apk"
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #10] Performing Streamed Install
Success

detox[89662] DEBUG: [exec.js/EXEC_CMD, #11] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r
 -g -t "/Users/jason/Code/RNDetox/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk"
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #11] Performing Streamed Install
Success

detox[89662] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeTerminateApp({ deviceId: 'emulator-5554', bund
leId: 'com.rndetox' })
detox[89662] DEBUG: [exec.js/EXEC_CMD, #12] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "am 
force-stop com.rndetox"
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #12] 
detox[89662] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeLaunchApp({ deviceId: 'emulator-5554',
  bundleId: 'com.rndetox',
  launchArgs: 
   { detoxServer: 'ws://localhost:49694',
     detoxSessionId: '67ad6740-d299-f127-cdf7-72d96443097a' } })
detox[89662] DEBUG: [exec.js/EXEC_CMD, #13] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "dat
e +\"%m-%d %T.000\""
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #13] 06-14 01:12:22.000

detox[89662] DEBUG: [exec.js/EXEC_CMD, #14] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "pm 
list instrumentation"
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #14] instrumentation:com.rndetox.test/androidx.test.runner.AndroidJUnitRunner (t
arget=com.rndetox)
instrumentation:org.chromium.webview_shell/.WebViewLayoutTestRunner (target=org.chromium.webview_shell)

detox[89662] DEBUG: [exec.js/SPAWN_CMD, #15] [pid=89682] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-55
54 shell am instrument -w -r -e detoxServer ws://localhost:49694 -e detoxSessionId 67ad6740-d299-f127-cdf7-72d96443097a -e 
debug ZmFsc2U= com.rndetox.test/androidx.test.runner.AndroidJUnitRunner
detox[89662] TRACE: [exec.js/SPAWN_STDOUT, #15] INSTRUMENTATION_STATUS: class=com.rndetox.DetoxTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
com.rndetox.DetoxTest:
INSTRUMENTATION_STATUS: test=runDetoxTests
INSTRUMENTATION_STATUS_CODE: 1

detox[89662] DEBUG: [exec.js/EXEC_CMD, #16] /Users/jason/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "ps 
| grep \"com\.rndetox$\""
detox[89662] TRACE: [exec.js/EXEC_SUCCESS, #16] u0_a103       8089  1694 1527688 146268 0                   0 S com.rndetox

detox[8089] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onLaunchApp({ deviceId: 'emulator-5554',
  bundleId: 'com.rndetox',
  launchArgs: 
   { detoxServer: 'ws://localhost:49694',
     detoxSessionId: '67ad6740-d299-f127-cdf7-72d96443097a' },
  pid: 8089 })
detox[89662] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"isReady","params":{},"messageId":-1000}
detox[89662] TRACE: [DetoxServer.js/MESSAGE] role=tester action=isReady (sessionId=67ad6740-d299-f127-cdf7-72d96443097a)
detox[89662] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=67ad6740-d299-f1
27-cdf7-72d96443097a)
triagbug android

Most helpful comment

I'm having a similar issue with react-native 0.60.0 with API 29.

Detox runs in debug mode but not in release mode.
The app is installed correctly on the simulator and is a working copy (functions worked when click around manually)

However, after the app is launched, there is an error [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action

Does detox requires the metro bundler for release builds?
In my case, even when the metro bundler is running in the background, there is no response.

All 28 comments

i have the same problem. Here is my logs

$ detox test --configuration android.emu.release --loglevel trace
detox[11697] INFO: [test.js] configuration="android.emu.release" loglevel="trace" artifactsLocation="artifacts/android.emu.release.2019-06-14 12-43-46Z" recordLogs="none" takeScreenshots="manual" recordVideos="none" recordPerformance="none" reportSpecs=true node_modules/.bin/jest --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:ios:).)*$' "e2e"
detox[11698] INFO: [DetoxServer.js] server listening on localhost:49363...
detox[11698] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:49363
detox[11698] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"740a07be-6e9c-268e-5d54-a630e49653f7","role":"tester"},"messageId":0}
detox[11698] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=740a07be-6e9c-268e-5d54-a630e49653f7
detox[11698] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=740a07be-6e9c-268e-5d54-a630e49653f7
detox[11698] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"740a07be-6e9c-268e-5d54-a630e49653f7","role":"tester"},"messageId":0}

detox[11698] DEBUG: [exec.js/EXEC_CMD, #0] /Users/dzhafarov.maxim/Library/Android/sdk/emulator/emulator -list-avds --verbose
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #0] Nexus_5X_API_28_x86
Nexus_S_API_19

detox[11698] DEBUG: [exec.js/EXEC_CMD, #1] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb devices
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #1] List of devices attached
emulator-5554 device

detox[11698] TRACE: [EmulatorTelnet.js/TELNET_CONNECTING] port: 5554, host: localhost
detox[11698] DEBUG: [exec.js/EXEC_CMD, #2] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "getprop dev.bootcomplete"
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #2] 1

detox[11698] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBootDevice({ coldBoot: false, deviceId: 'emulator-5554' })
detox[11698] DEBUG: [exec.js/EXEC_CMD, #3] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "getprop ro.build.version.sdk"
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #3] 28

detox[11698] DEBUG: [exec.js/EXEC_CMD, #4] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "dumpsys power | grep \"^[ ]m[UW].=\""
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #4] mWakefulness=Awake
mWakefulnessChanging=false
mWakeLockSummary=0x0
mUserActivitySummary=0x1
mWakeUpWhenPluggedOrUnpluggedConfig=false
mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig=false
mUserActivityTimeoutOverrideFromWindowManager=-1
mUserInactiveOverrideFromWindowManager=false

detox[11698] DEBUG: [exec.js/EXEC_CMD, #5] /Users/dzhafarov.maxim/Library/Android/sdk/build-tools/28.0.3/aapt dump badging "/Users/dzhafarov.maxim/Projects/cobra/sirius/android/app/build/outputs/apk/release/app-x86-release.apk" | grep -e "package: name="
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #5] package: name='com.sirius' versionCode='3' versionName='###VERSION_NAME###' platformBuildVersionName='###VERSION_NAME###' compileSdkVersion='28' compileSdkVersionCodename='9'

detox[11698] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeUninstallApp({ deviceId: 'emulator-5554', bundleId: 'com.sirius' })
detox[11698] DEBUG: [exec.js/EXEC_CMD, #6] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "pm list packages com.sirius"
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #6] package:com.sirius
package:com.sirius.test

detox[11698] DEBUG: [exec.js/EXEC_CMD, #7] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall com.sirius
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #7] Success

detox[11698] DEBUG: [exec.js/EXEC_CMD, #8] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "pm list packages com.sirius.test"
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #8] package:com.sirius.test

detox[11698] DEBUG: [exec.js/EXEC_CMD, #9] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall com.sirius.test
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #9] Success

detox[11698] DEBUG: [exec.js/EXEC_CMD, #10] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g -t "/Users/dzhafarov.maxim/Projects/cobra/sirius/android/app/build/outputs/apk/release/app-x86-release.apk"
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #10] Performing Streamed Install
Success

detox[11698] DEBUG: [exec.js/EXEC_CMD, #11] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g -t "/Users/dzhafarov.maxim/Projects/cobra/sirius/android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk"
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #11] Performing Streamed Install
Success

detox[11698] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeTerminateApp({ deviceId: 'emulator-5554', bundleId: 'com.sirius' })
detox[11698] DEBUG: [exec.js/EXEC_CMD, #12] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "am force-stop com.sirius"
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #12]
detox[11698] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeLaunchApp({
deviceId: 'emulator-5554',
bundleId: 'com.sirius',
launchArgs: {
detoxServer: 'ws://localhost:49363',
detoxSessionId: '740a07be-6e9c-268e-5d54-a630e49653f7'
}
})
detox[11698] DEBUG: [exec.js/EXEC_CMD, #13] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "date +\"%m-%d %T.000\""
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #13] 06-14 15:43:50.000

detox[11698] DEBUG: [exec.js/EXEC_CMD, #14] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "pm list instrumentation"
detox[11698] TRACE: [exec.js/EXEC_SUCCESS, #14] instrumentation:com.sirius.test/androidx.test.runner.AndroidJUnitRunner (target=com.sirius)
instrumentation:org.chromium.webview_shell/.WebViewLayoutTestRunner (target=org.chromium.webview_shell)

detox[11698] DEBUG: [exec.js/SPAWN_CMD, #15] [pid=11720] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:49363 -e detoxSessionId 740a07be-6e9c-268e-5d54-a630e49653f7 -e debug ZmFsc2U= com.sirius.test/androidx.test.runner.AndroidJUnitRunner
detox[11698] TRACE: [exec.js/SPAWN_STDOUT, #15] INSTRUMENTATION_STATUS: class=com.sirius.DetoxTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
com.sirius.DetoxTest:
INSTRUMENTATION_STATUS: test=runDetoxTests
INSTRUMENTATION_STATUS_CODE: 1

detox[11698] DEBUG: [exec.js/EXEC_CMD, #16] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "ps | grep \"com.sirius$\""
detox[11698] DEBUG: [exec.js/EXEC_FAIL, #16] "/Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "ps | grep \"com.sirius$\""" failed with code = 1, stdout and stderr:

detox[11698] DEBUG: [exec.js/EXEC_FAIL, #16]
detox[11698] DEBUG: [exec.js/EXEC_FAIL, #16]
detox[11698] TRACE: [exec.js/SPAWN_STDOUT, #15] INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0

detox[11698] DEBUG: [exec.js/KILL] sending SIGINT to [pid = 11720]: /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:49363 -e detoxSessionId 740a07be-6e9c-268e-5d54-a630e49653f7 -e debug ZmFsc2U= com.sirius.test/androidx.test.runner.AndroidJUnitRunner
detox[11698] TRACE: [exec.js/SPAWN_END, #15] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:49363 -e detoxSessionId 740a07be-6e9c-268e-5d54-a630e49653f7 -e debug ZmFsc2U= com.sirius.test/androidx.test.runner.AndroidJUnitRunner finished with code = 0
detox[11698] DEBUG: [exec.js/EXEC_CMD, #17] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "ps | grep \"com.sirius$\""
detox[11698] DEBUG: [exec.js/EXEC_FAIL, #17] "/Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "ps | grep \"com.sirius$\""" failed with code = 1, stdout and stderr:

detox[11698] DEBUG: [exec.js/EXEC_FAIL, #17]
detox[11698] DEBUG: [exec.js/EXEC_FAIL, #17]
detox[11698] DEBUG: [exec.js/EXEC_CMD, #18] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "ps | grep \"com.sirius$\""
detox[11698] DEBUG: [exec.js/EXEC_FAIL, #18] "/Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "ps | grep \"com.sirius$\""" failed with code = 1, stdout and stderr:

detox[11698] DEBUG: [exec.js/EXEC_FAIL, #18]
detox[11698] DEBUG: [exec.js/EXEC_FAIL, #18]
detox[11698] DEBUG: [exec.js/EXEC_CMD, #19] /Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "ps | grep \"com.sirius$\""
detox[11698] DEBUG: [exec.js/EXEC_FAIL, #19] "/Users/dzhafarov.maxim/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell "ps | grep \"com.sirius$\""" failed with code = 1, stdout and stderr:

Same problem here. Has anybody found a solution or a work-around?

I have a question to the issue reporters and upvoters:

Are you familiar with ProGuard?

If yes, could you check you have correct configurations? Check demo-react-native as a reference, as we are running e2e against RN 0.59.x in release mode on Android.

There might be extra info for you in https://github.com/wix/Detox/pull/1249/files, which added instructions here: https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md#proguard-minification

Not running proguard, still see the issue. Update: The example above doesn't have proguard enabled either.

I had gone through line by line every android/gradle config from the demo app including the ProGuard settings and I still got the same results. I didn't include additional config like ProGuard in my example as I wanted a minimal example.

The docs say:

In apps running minification using Proguard...'

which suggest that it's not required?

It's baffling - the only major differences between a clean install and the demo is that the demo uses rn-cli.config.js where my example uses metro.config.js

I would be interested to see a fully working example with a clean install.

Just an update here: It seems like there may be an underlying environmental issue causing this. A colleague of mine is able to run tests against RN0.59, while I'm not on a project with identical setups. We'll dig deeper to see if we can find any issues.

Just an update here: It seems like there may be an underlying environmental issue causing this. A colleague of mine is able to run tests against RN0.59, while I'm not on a project with identical setups. We'll dig deeper to see if we can find any issues.

@kristfal Just to add to that. I can run the example app on the same machine without any issues.

A little bit of evidence from my tests: I can reproduce the error on an Android 9.0 emulator, but the exact same app works fine on an Android 8.0 emulator. I've been using these docker images for testing (budtmo/docker-android-x86-9.0 and budtmo/docker-android-x86-8.0).

I think it's related to #1297

As workaround change targetSdkVersion as stated here

I'm having a similar issue with react-native 0.60.0 with API 29.

Detox runs in debug mode but not in release mode.
The app is installed correctly on the simulator and is a working copy (functions worked when click around manually)

However, after the app is launched, there is an error [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action

Does detox requires the metro bundler for release builds?
In my case, even when the metro bundler is running in the background, there is no response.

Can also confirm that downgrading Emulator Target API to 28 or lower fixes the issue for us.

I'm having a similar issue with react-native 0.61.2 with API 28.

There is an error [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action

Also have problem on react 60.5 with api 27, saying:
detox[3037] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=c2b87fa2-271f-8de0-6a62-4c5bb6abc90c) detox[3037] TRACE: [exec.js/SPAWN_STDOUT, #16] INSTRUMENTATION_RESULT: shortMsg=Process crashed. INSTRUMENTATION_CODE: 0

On debug mode , I firstly need to run react-native start and only after I need to run detox test -c android.emu.debug. Dont you run metro bundler on background when running detox test?

Do I need to run metro bundler when running detox on release mode?

I news about this error? It still occurring here

also having this issue

I'm having the same issue in debug mode as well. Any update on this? Targeting API to 28 or lower does not work for us

work for me by setting the targetSdkVersion to 27

We've been having some issues with SDK 28 or newer, namely #1728. Please give this issue another try using Detox 14.9.x (latest). Thank you.

^ This of course is on top of properly configuring proguard / R8, as @noomorph mentioned

"detox": "^14.9.1",
"react-native": "0.61.5"

still facing this problem.
detox[26550] ERROR: [exec.js/EXEC_FAIL, #18] ""/Users/jeffrey/Library/Android/sdk/platform-tools/adb" -s emulator-5554 shell "ps | grep \"com\.detoxplay$\""" failed with code = 1, stdout and stderr:

The emulator didn't open the app.

same issue in debug mode after upgrading to 14.9.2. We're not using proguard in debug mode

Detox: 15.1.2
React Native: 0.61.5
Node: 13.5.0
Device: Android Stock Emulator
OS: macOS

After changing targetSdkVersion to 27 e2e testing works fine in android release mode. If it is 28 the test just hangs after installing the app in the emulator.

The workaround that is working for me is also to set api to 27.

@jasonhealy sorry for this taking forever, I'm looking into it.

@jasonhealy As I've already mentioned in a similar issue (https://github.com/wix/Detox/issues/1743#issuecomment-555003042), starting SDK 28 clear-text network permissions must be sorted out for every app. In the very minimum, android:usesCleartextTraffic="true" must be applied on the application tag in AndroidManifest.xml. That is mandatory for Detox to be able to work.

Judging by the demo app you've set up, your error was that you've applied android:usesCleartextTraffic="true" onto a specific AndroidManifest.xml override you've created strictly for debug mode. Adding the tag to the root manifest solves the issue there.

Similar to Hubert Dworczy艅ski, we are still seeing the problem after running the sed script. We thought the sed script fix would remedy the problem, so we've been going over and over our configuration looking for some other simple unrelated error on our part.

We require the functionality in SDK 28, so stepping back to SDK 27 isn't an option.

I'll take a look at the solution proposed by @jasonhealy about setting android:usesCleartextTraffic="true" later today. As that would be a configuration issue.

I've added some further description of how the clear-text issue can be tackled in our android-troubleshooting guide: https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md#problem-the-app-loads-but-tests-fail-to-start-in-sdk--28

UPDATE: Thanks to @imownbey in #2061, I've had the documentation related to clear-text traffic updated with a proper solution -- https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md#6-enable-clear-text-unencrypted-traffic-for-detox. This is to replace the previous troubleshooting link I've shared.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kceb picture kceb  路  4Comments

LeoNatan picture LeoNatan  路  4Comments

carlosalmonte04 picture carlosalmonte04  路  4Comments

brunobar79 picture brunobar79  路  4Comments

JB-CHAUVIN picture JB-CHAUVIN  路  3Comments