Open dima opened 1 year ago
same issue occurs when enable fabric (app crash immediately after start tests)
The app has crashed, see the details below:
@Thread detox.primary(2154):
java.lang.NullPointerException: Attempt to invoke virtual method 'okhttp3.Dispatcher okhttp3.OkHttpClient.dispatcher()' on a null object reference
at com.wix.detox.reactnative.idlingresources.NetworkIdlingResource.<init>(NetworkIdlingResource.java:58)
at com.wix.detox.reactnative.ReactNativeIdlingResources.setupNetworkIdlingResource(ReactNativeIdlingResources.kt:208)
at com.wix.detox.reactnative.ReactNativeIdlingResources.setupCustomRNIdlingResources(ReactNativeIdlingResources.kt:151)
at com.wix.detox.reactnative.ReactNativeIdlingResources.registerAll(ReactNativeIdlingResources.kt:73)
at com.wix.detox.reactnative.ReactNativeExtension.setupIdlingResources(ReactNativeExtension.kt:144)
at com.wix.detox.reactnative.ReactNativeExtension.enableOrDisableSynchronization(ReactNativeExtension.kt:131)
at com.wix.detox.reactnative.ReactNativeExtension.enableOrDisableSynchronization$default(ReactNativeExtension.kt:127)
at com.wix.detox.reactnative.ReactNativeExtension.waitForRNBootstrap(ReactNativeExtension.kt:61)
at com.wix.detox.DetoxMain.initReactNativeIfNeeded(DetoxMain.kt:102)
at com.wix.detox.DetoxMain.doInit(DetoxMain.kt:34)
at com.wix.detox.DetoxMain.access$doInit(DetoxMain.kt:15)
at com.wix.detox.DetoxMain$initActionHandlers$1$1.handle(DetoxMain.kt:52)
at com.wix.detox.adapters.server.ActionsExecutor.executeAction$lambda-2$lambda-1(DetoxActionsDispatcher.kt:64)
at com.wix.detox.adapters.server.ActionsExecutor.$r8$lambda$nk3cF8ntnfFqbJOcVqd04vjb5nY(Unknown Source:0)
at com.wix.detox.adapters.server.ActionsExecutor$$ExternalSyntheticLambda1.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at com.wix.detox.adapters.server.ActionsExecutor._init_$lambda-0(DetoxActionsDispatcher.kt:50)
at com.wix.detox.adapters.server.ActionsExecutor.$r8$lambda$Hi5vyewqQiQqk57AkJy_cHqNGKY(Unknown Source:0)
at com.wix.detox.adapters.server.ActionsExecutor$$ExternalSyntheticLambda0.run(Unknown Source:4)
at java.lang.Thread.run(Thread.java:923)
Check device logs for full details!
import { device, by, expect, element } from 'detox';
describe('example', () => {
beforeAll(async () => {
await device.launchApp({ newInstance: true }); // << Crash here
});
beforeEach(async () => {
await device.reloadReactNative();
});
it('should have welcome screen', async () => {
await expect(element(by.id('demo'))).toBeVisible();
});
});
@dima, @leegeunhyeok thanks for your reports! This might be related to the fact that you use RN .70, which is not yet tested with Detox. I have no clear indication as to the root cause of the problem, and unfortunately, Detox might not support this version yet (see the tested versions on our README).
same issue occurs when enable fabric
@leegeunhyeok - if you disable Fabric, the crash is gone?
We plan to work on support for this version of React Native very soon, so we will take your issue into account. @jonathanmos @d4vidi FYI.
@dima @leegeunhyeok this might also be related to Flipper, do you have it enabled? if so - can you try disable it?
(1) if you disable Fabric, the crash is gone? (2) this might also be related to Flipper, do you have it enabled? if so - can you try disable it?
(I tested in official react-native typescript template. checkout demo project here: https://github.com/leegeunhyeok/react-native-detox-demo)
@asafkorem If Fabric is disabled, the test code will run successfully both Android and iOS. (with Flipper) and I tried to enable Fabric + disable Flipper and run tests, but still same issue occurs.
Additionally, another issue has been discovered in an iOS app with Fabric enabled. (It's may not related to this #3720 issue)
Test app started successfully in the device after running the tests, but test code stuck at launchApp()
(no async code, no animations)
To summarize, the following is the case:
launchApp
, exited by timeoutWe will be sure to take this into account when upgrading Detox to properly comply with RN .70+ with Fabric enabled, hopefully, during Q1-Q2/2023.
Same issue here.
"react": "18.2.0",
"react-native": "0.71.1",
// ...
"detox": "^20.1.2",
My first TS project, btw
What happened?
Running a very basic RN app to test Detox setup, everything runs great on iOS but I am running into this issue on Android:
Searched existing issues, GitHub doesn't seem to know anything about okhttp3 errors. Maybe something weird with my setup? Running Flipper 0.125 + RN0.70.2 + Detox20.0.3
What was the expected behaviour?
A basic test should pass.
Was it tested on latest Detox?
Did your test throw out a timeout?
Help us reproduce this issue!
No response
In what environment did this happen?
Detox version: 20.0.3 React Native version: 0.70.2 Node version: 16.8.1 Device model: Pixel 3 Android version: 31 Test-runner (select one): jest
Detox logs
Detox logs
``` 16:22:57.280 detox[85067] [90mE[39m launchApp error: The app has crashed, see the details below: @Thread detox.primary(65): java.lang.NullPointerException: Attempt to invoke virtual method 'okhttp3.Dispatcher okhttp3.OkHttpClient.dispatcher()' on a null object reference at com.wix.detox.reactnative.idlingresources.NetworkIdlingResource.Device logs
Device logs
``` 11-21 16:22:39.835 3222 3319 I TestRunner: run started: 1 tests 11-21 16:22:39.837 3222 3319 I TestRunner: started: runDetoxTests(com.sortinox.DetoxTest) 11-21 16:22:39.851 3222 3319 D EventInjectionStrategy: Creating injection strategy with input manager. 11-21 16:22:39.852 3222 3319 W com.sortinox: Accessing hidden method Landroid/hardware/input/InputManager;->getInstance()Landroid/hardware/input/InputManager; (unsupported, reflection, allowed) 11-21 16:22:39.853 3222 3319 W com.sortinox: Accessing hidden method Landroid/hardware/input/InputManager;->injectInputEvent(Landroid/view/InputEvent;I)Z (unsupported, reflection, allowed) 11-21 16:22:39.853 3222 3319 W com.sortinox: Accessing hidden field Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I (unsupported, reflection, allowed) 11-21 16:22:39.861 3222 3319 W com.sortinox: Accessing hidden field Ljava/lang/reflect/Field;->accessFlags:I (unsupported, reflection, allowed) 11-21 16:22:39.985 3222 3339 V SoLoader: libreactnativejni.so not found on /data/data/com.sortinox/lib-main 11-21 16:22:39.985 3222 3339 D SoLoader: libreactnativejni.so found on /data/app/~~HKrm-Eu_6HUT6S3Llfd2UQ==/com.sortinox-oLOziQyDWK1UOTAHzJk96A==/lib/x86_64 11-21 16:22:39.986 3222 3339 D SoLoader: Not resolving dependencies for libreactnativejni.so 11-21 16:22:40.699 3222 3400 D libEGL : loaded /vendor/lib64/egl/libEGL_emulation.so 11-21 16:22:40.707 3222 3400 D libEGL : loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so 11-21 16:22:40.710 3222 3400 D libEGL : loaded /vendor/lib64/egl/libGLESv2_emulation.so 11-21 16:22:41.061 3222 3222 D LifecycleMonitor: Lifecycle status change: com.sortinox.MainActivity@e4d0d0c in: PRE_ON_CREATE 11-21 16:22:41.277 3222 3222 W com.sortinox: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed) 11-21 16:22:41.282 3222 3222 W com.sortinox: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed) 11-21 16:22:41.346 3222 3222 D LifecycleMonitor: Lifecycle status change: com.sortinox.MainActivity@e4d0d0c in: CREATED 11-21 16:22:41.351 3222 3222 D LifecycleMonitor: Lifecycle status change: com.sortinox.MainActivity@e4d0d0c in: STARTED 11-21 16:22:41.363 3222 3222 D LifecycleMonitor: Lifecycle status change: com.sortinox.MainActivity@e4d0d0c in: RESUMED 11-21 16:22:41.412 3222 3222 W unknown:ReactNative: Packager connection already open, nooping. 11-21 16:22:41.484 3222 3398 D HostConnection: createUnique: call 11-21 16:22:41.493 3222 3398 D HostConnection: HostConnection::get() New Host Connection established 0x7011be41be10, tid 3398 11-21 16:22:41.509 3222 3398 D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0 11-21 16:22:41.523 3222 3398 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 11-21 16:22:41.524 3222 3398 W OpenGLRenderer: Failed to initialize 101010-2 format, error = EGL_SUCCESS 11-21 16:22:41.532 3222 3398 D EGL_emulation: eglCreateContext: 0x7011be41d0d0: maj 3 min 0 rcv 3 11-21 16:22:41.537 3222 3398 D EGL_emulation: eglMakeCurrent: 0x7011be41d0d0: ver 3 0 (tinfo 0x7013ebed3080) (first time) 11-21 16:22:41.603 3222 3398 I Gralloc4: mapper 4.x is not supported 11-21 16:22:41.610 3222 3398 D HostConnection: createUnique: call 11-21 16:22:41.611 3222 3398 D HostConnection: HostConnection::get() New Host Connection established 0x7011be41c050, tid 3398 11-21 16:22:41.611 3222 3398 D goldfish-address-space: allocate: Ask for block of size 0x100 11-21 16:22:41.612 3222 3398 D goldfish-address-space: allocate: ioctl allocate returned offset 0x3f7ffe000 size 0x2000 11-21 16:22:41.614 3222 3398 W Gralloc4: allocator 4.x is not supported 11-21 16:22:41.627 3222 3398 D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0 11-21 16:22:42.630 3222 3249 I OpenGLRenderer: Davey! duration=890ms; Flags=1, FrameTimelineVsyncId=1736, IntendedVsync=95721776636, Vsync=95721776636, InputEventId=0, HandleInputStart=95726435196, AnimationStart=95726437607, PerformTraversalsStart=95726439321, DrawStart=96494317894, FrameDeadline=95738443302, FrameInterval=95726417701, FrameStartTime=16666666, SyncQueued=96495169640, SyncStart=96498664596, IssueDrawCommandsStart=96498722523, SwapBuffers=96559107773, FrameCompleted=96615655611, DequeueBufferDuration=5015, QueueBufferDuration=20038402, GpuCompleted=96615596243, SwapBuffersCompleted=96615655611, DisplayPresentTime=0, 11-21 16:22:42.956 3222 3319 I Detox : Detox server connection details: url=ws://localhost:51902, sessionId=ce1ccd7f-1983-2ca5-0a10-78f49080c525 11-21 16:22:42.967 3222 3415 I DetoxDispatcher: Handling action '_init' (ID #0)... 11-21 16:22:42.967 3222 3415 I Detox : Connecting to server... 11-21 16:22:42.967 3222 3415 I DetoxWSClient: At connectToServer 11-21 16:22:43.201 3222 3419 D DetoxWSClient: At onOpen 11-21 16:22:43.201 3222 3419 I DetoxWSClient: Sending out action 'login' (ID #0) 11-21 16:22:43.202 3222 3419 I Detox : Connected to server! 11-21 16:22:43.228 3222 3419 D DetoxWSClient: Received action 'loginSuccess' (ID #0, params={"testerConnected":true,"appConnected":true}) 11-21 16:22:43.231 3222 3419 D DetoxWSClient: Received action 'isReady' (ID #-1000, params={}) 11-21 16:22:43.918 3222 3398 D EGL_emulation: app_time_stats: avg=434.56ms min=75.75ms max=1041.87ms count=3 11-21 16:22:45.595 3222 3398 D EGL_emulation: app_time_stats: avg=335.31ms min=8.33ms max=1234.16ms count=5 11-21 16:22:46.637 3222 3398 D EGL_emulation: app_time_stats: avg=44.01ms min=4.26ms max=274.82ms count=23 11-21 16:22:47.749 3222 3398 D EGL_emulation: app_time_stats: avg=40.04ms min=2.72ms max=183.56ms count=27 11-21 16:22:49.834 3222 3222 D LifecycleMonitor: Lifecycle status change: com.sortinox.MainActivity@e4d0d0c in: PAUSED 11-21 16:22:49.848 3222 3732 W unknown:ReactContext: initializeMessageQueueThreads() is called. 11-21 16:22:49.849 3222 3732 V SoLoader: libsortinox_appmodules.so not found on /data/data/com.sortinox/lib-main 11-21 16:22:49.849 3222 3732 D SoLoader: libsortinox_appmodules.so found on /data/app/~~HKrm-Eu_6HUT6S3Llfd2UQ==/com.sortinox-oLOziQyDWK1UOTAHzJk96A==/lib/x86_64 11-21 16:22:49.849 3222 3732 D SoLoader: Not resolving dependencies for libsortinox_appmodules.so 11-21 16:22:50.186 3222 3222 D LifecycleMonitor: Lifecycle status change: com.sortinox.MainActivity@e4d0d0c in: RESUMED 11-21 16:22:50.423 3222 3732 V SoLoader: libturbomodulejsijni.so not found on /data/data/com.sortinox/lib-main 11-21 16:22:50.430 3222 3732 D SoLoader: libturbomodulejsijni.so found on /data/app/~~HKrm-Eu_6HUT6S3Llfd2UQ==/com.sortinox-oLOziQyDWK1UOTAHzJk96A==/lib/x86_64 11-21 16:22:50.430 3222 3732 D SoLoader: Not resolving dependencies for libturbomodulejsijni.so 11-21 16:22:50.622 3222 3222 W unknown:ReactNative: Packager connection already open, nooping. 11-21 16:22:50.639 3222 3222 D DetoxRNLoading: Listener-proxy method called: onReactContextInitialized 11-21 16:22:50.639 3222 3222 I DetoxRNLoading: Got new RN-context async'ly through listener 11-21 16:22:50.640 3222 3222 D DetoxRNLoading: Listener-proxy method called: equals 11-21 16:22:50.640 3222 3222 D DetoxRNLoading: Listener-proxy method called: equals 11-21 16:22:50.641 3222 3415 I DetoxRNIdleRes: Setting up Espresso Idling Resources for React Native 11-21 16:22:50.654 3222 3742 W com.sortinox: Accessing hidden method Landroid/os/MessageQueue;->next()Landroid/os/Message; (unsupported, reflection, allowed) 11-21 16:22:50.654 3222 3742 W com.sortinox: Accessing hidden field Landroid/os/MessageQueue;->mMessages:Landroid/os/Message; (unsupported, reflection, allowed) 11-21 16:22:50.654 3222 3742 W com.sortinox: Accessing hidden method Landroid/os/Message;->recycleUnchecked()V (unsupported, reflection, allowed) --------- beginning of crash 11-21 16:22:50.664 3222 3415 E AndroidRuntime: FATAL EXCEPTION: detox.primary 11-21 16:22:50.664 3222 3415 E AndroidRuntime: Process: com.sortinox, PID: 3222 11-21 16:22:50.664 3222 3415 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'okhttp3.Dispatcher okhttp3.OkHttpClient.dispatcher()' on a null object reference 11-21 16:22:50.664 3222 3415 E AndroidRuntime: at com.wix.detox.reactnative.idlingresources.NetworkIdlingResource.More data, please!
No response