Detox: Detox hangs when running android
Hi, First of all, I really like Detox, so thank you for this library!
Describe the bug I’m trying to run Detox tests on react native android device in debug mode.
The tests aren’t running, and detox trace shows "CANNOT_FORWARD:
If in different terminal I start react-native bundle and press “R” for reloading it, the tests start to run.
To Reproduce
- I follow the android environment setUp 2.write tests 3.run detox on android 4.the device open with the app 5.the tests hangs
Expected behavior Detox start running over the tests
Device and Verbose Detox Logs
detox[97978] DEBUG: [exec.js/EXEC_CMD, #21] "/Android/sdk/platform-tools/adb" -s emulator-17722 shell "date +\"%m-%d %T.000\""
detox[97978] DEBUG: [exec.js/EXEC_CMD, #22] "/Android/sdk/platform-tools/adb" -s emulator-17722 reverse tcp:64867 tcp:64867
detox[97978] DEBUG: [exec.js/EXEC_CMD, #23] "/Android/sdk/platform-tools/adb" -s emulator-17722 shell "pm list instrumentation"
detox[97978] DEBUG: [exec.js/SPAWN_CMD, #24] [pid=98010] /Android/sdk/platform-tools/adb -s emulator-17722 shell am instrument -w -r -e detoxServer ws://localhost:64867 -e detoxSessionId 2f0e4128-30e3-0737-4ac0-74907e3abed9 -e debug false com.aaa.myWireless.test/androidx.test.runner.AndroidJUnitRunner
detox[97978] DEBUG: [exec.js/EXEC_CMD, #25] "/Android/sdk/platform-tools/adb" -s emulator-17722 shell "ps | grep \"com\.aaa\.myWireless$\""
detox[97978] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=2f0e4128-30e3-0737-4ac0-74907e3abed9)
I tried it on this simulators:


Environment (please complete the following information):
- Detox:“^17.10.0”
- React Native:“0.61.5”
- Node:v14.8.0
- Device:“Pixel_3a_XL_API_29”
- OS: MacOS
- Test-runner (select one):
jest-circus
I tried it too :
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 10
- Comments: 26
@d4vidi thanks, this tip helped me. Here is full
DetoxTest.java
code which solvedcom.wix.detox.common.DetoxErrors$DetoxRuntimeException: Waited for the new RN-context for too long! (60 seconds)
for me.@d4vidi Unfortunately no, we tried for a month to understand the problem there(figure out why the app doesn’t load the JS code) but we didn’t find any solution from our side.
+1
same here
I have the same problem, can not run tests without pressing the reload bundle
Hi @barak109 would you mind sharing the file where you used this code? We have the same problem with Android, it just seems to hang.
Hi guys, We found out a solution, add inside your android first activity that line:
getReactNativeHost().getReactInstanceManager().getDevSupportManager().handleReloadJS();
Same here