Closed baskarkarthik closed 2 years ago
@baskarkarthik this was essentially fixed in 19.8.4
, which I see that you're already using.
In that case, my guess is that this could be related to obfuscation that you could be running over your project's code. Do you have a debug mode where obfuscation+minification are disabled? Alternatively, blindly adding some dedicated ProGuard rules could do the trick as well, but best if we take this one step at a time. Would love to hear from you.
In any case, before anything else (and after), please hard-delete all of your build directories (android/build/
, android/app/build
).
For reference - extracted from Detox's logs is this stacktrace:
@Thread detox.primary(546):
java.lang.RuntimeException: java.lang.ClassNotFoundException: com.facebook.react.ReactInstanceEventListener
at androidx.test.runner.MonitoringInstrumentation.runOnMainSync(MonitoringInstrumentation.java:469)
at com.wix.detox.reactnative.ReactNativeLoadingMonitor.subscribeToNewRNContextUpdates(ReactNativeLoadingMonitor.kt:33)
at com.wix.detox.reactnative.ReactNativeLoadingMonitor.getNewContext(ReactNativeLoadingMonitor.kt:28)
at com.wix.detox.reactnative.ReactNativeExtension.awaitNewReactNativeContext(ReactNativeExtension.kt:124)
at com.wix.detox.reactnative.ReactNativeExtension.waitForRNBootstrap(ReactNativeExtension.kt:59)
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$$inlined$with$lambda$1.handle(DetoxMain.kt:52)
at com.wix.detox.adapters.server.ActionsExecutor$executeAction$$inlined$let$lambda$1.run(DetoxActionsDispatcher.kt:64)
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$1.run(DetoxActionsDispatcher.kt:50)
at java.lang.Thread.run(Thread.java:923)
Caused by: java.lang.ClassNotFoundException: com.facebook.react.ReactInstanceEventListener
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at com.wix.detox.reactnative.ReactNativeLoadingMonitorKt.resolveListenerClass(ReactNativeLoadingMonitor.kt:128)
at com.wix.detox.reactnative.ReactNativeLoadingMonitorKt.subscribeAsyncRNContextHandler(ReactNativeLoadingMonitor.kt:100)
at com.wix.detox.reactnative.ReactNativeLoadingMonitorKt.access$subscribeAsyncRNContextHandler(ReactNativeLoadingMonitor.kt:1)
at com.wix.detox.reactnative.ReactNativeLoadingMonitor$subscribeToNewRNContextUpdates$1.run(ReactNativeLoadingMonitor.kt:43)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:2223)
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 android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.ClassNotFoundException: Didn't find class \"com.facebook.react.ReactInstanceEventListener\" on path: DexPathList[[zip file \"\/system\/framework\/android.test.runner.jar\", zip file \"\/system\/framework\/android.test.mock.jar\", zip file \"\/system\/framework\/android.test.base.jar\", zip file \"\/data\/app\/~~CT0IuL1gs9CLtBL-G0PDvA==\/com.apple.mobileapp.beta.test-SZYRSnPNpRWBmbWNK1ONHA==\/base.apk\", zip file \"\/data\/app\/~~hEXOOCrlHLurxY-3QEve7Q==\/com.apple.mobileapp.beta-tjXmQEUTjyDtBgknhfyPxg==\/base.apk\"],nativeLibraryDirectories=[\/data\/app\/~~CT0IuL1gs9CLtBL-G0PDvA==\/com.apple.mobileapp.beta.test-SZYRSnPNpRWBmbWNK1ONHA==\/lib\/x86, \/data\/app\/~~hEXOOCrlHLurxY-3QEve7Q==\/com.apple.mobileapp.beta-tjXmQEUTjyDtBgknhfyPxg==\/lib\/x86, \/data\/app\/~~CT0IuL1gs9CLtBL-G0PDvA==\/com.apple.mobileapp.beta.test-SZYRSnPNpRWBmbWNK1ONHA==\/base.apk!\/lib\/x86, \/data\/app\/~~hEXOOCrlHLurxY-3QEve7Q==\/com.apple.mobileapp.beta-tjXmQEUTjyDtBgknhfyPxg==\/base.apk!\/lib\/x86, \/system\/lib, \/system_ext\/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 17 more
Check device logs for full details!
I'm getting the same error with 19.9.2
while 19.8.1
works perfectly.
I'm thinking about adding some extra proguard rules
@d4vidi okay, I found a fix.
Just add
-keep class com.facebook.react.ReactInstanceEventListener { *; }
to your proguard-rules.pro file.
I can open a PR shortly with a fix, so we don't have to keep it in our project files 👍
@d4vidi - Thank you for the solution. I added 'minifyEnabled = false'
in build.gradle file, working fine in android API v30 and 31.
buildTypes {
release {
minifyEnabled = false
......
}
}
When I try to run same script in android API v33 - scripts are failing, button tap or typing in text fields are not happening properly @d4vidi - Does Android 13(API-33) not have support for Detox?
@StasDoskalenkoHover thanks you. A PR would be much appreciated. I think the rule should be added to detox/proguard-rules-app.pro
. ~LMK if you could do that on your own.~ I co-authored you on #3226
@baskarkarthik that's good to know, but please don't disable minification altogether over this. Best to apply the missing proguard rule as @baskarkarthik suggested.
IDK about Android 13, we haven't tried that yet.
What happened?
When I try to run detox script with latest versions(v19.9.1, v19.8.4), below error message is displaying. RN68
Action dispatched too early, there is no session to use [APP_STATUS] The app seems to be idle
What was the expected behaviour?
App launches and automates (tap button, type in text fields, etc)
Was it tested on latest Detox?
Did your test throw out a timeout?
Help us reproduce this issue!
detox test -c android.emu.debug
In what environment did this happen?
Detox version: 19.8.4 React Native version: 0.68.2 Node version: 18.7.0 Device model: Emulator (Pixel 5, Api30, 31) Android version: v11, v12 Test-runner (select one): mocha
Detox logs
Detox logs
``` 00:03:16.600 detox[60927] TRACE: [SPAWN_STDOUT, #32, cpid=60977] INSTRUMENTATION_STATUS: class=com.apple.mobileapptool.DetoxTest INSTRUMENTATION_STATUS: current=1 INSTRUMENTATION_STATUS: id=AndroidJUnitRunner INSTRUMENTATION_STATUS: numtests=1 INSTRUMENTATION_STATUS: stream= com.apple.mobileapp.DetoxTest: INSTRUMENTATION_STATUS: test=runDetoxTests INSTRUMENTATION_STATUS_CODE: 1 00:03:17.272 detox[60927] DEBUG: [WSS_CONNECTION, #59292] registered a new connection. 00:03:17.301 detox[60927] TRACE: [WSS_GET_FROM, #59292] {"messageId":-10000,"type":"AppWillTerminateWithError","params":{"errorDetails":"@Thread detox.primary(546):\njava.lang.RuntimeException: java.lang.ClassNotFoundException: com.facebook.react.ReactInstanceEventListener\n\tat androidx.test.runner.MonitoringInstrumentation.runOnMainSync(MonitoringInstrumentation.java:469)\n\tat com.wix.detox.reactnative.ReactNativeLoadingMonitor.subscribeToNewRNContextUpdates(ReactNativeLoadingMonitor.kt:33)\n\tat com.wix.detox.reactnative.ReactNativeLoadingMonitor.getNewContext(ReactNativeLoadingMonitor.kt:28)\n\tat com.wix.detox.reactnative.ReactNativeExtension.awaitNewReactNativeContext(ReactNativeExtension.kt:124)\n\tat com.wix.detox.reactnative.ReactNativeExtension.waitForRNBootstrap(ReactNativeExtension.kt:59)\n\tat com.wix.detox.DetoxMain.initReactNativeIfNeeded(DetoxMain.kt:102)\n\tat com.wix.detox.DetoxMain.doInit(DetoxMain.kt:34)\n\tat com.wix.detox.DetoxMain.access$doInit(DetoxMain.kt:15)\n\tat com.wix.detox.DetoxMain$initActionHandlers$$inlined$with$lambda$1.handle(DetoxMain.kt:52)\n\tat com.wix.detox.adapters.server.ActionsExecutor$executeAction$$inlined$let$lambda$1.run(DetoxActionsDispatcher.kt:64)\n\tat android.os.Handler.handleCallback(Handler.java:938)\n\tat android.os.Handler.dispatchMessage(Handler.java:99)\n\tat android.os.Looper.loop(Looper.java:223)\n\tat com.wix.detox.adapters.server.ActionsExecutor$1.run(DetoxActionsDispatcher.kt:50)\n\tat java.lang.Thread.run(Thread.java:923)\nCaused by: java.lang.ClassNotFoundException: com.facebook.react.ReactInstanceEventListener\n\tat java.lang.Class.classForName(Native Method)\n\tat java.lang.Class.forName(Class.java:454)\n\tat java.lang.Class.forName(Class.java:379)\n\tat com.wix.detox.reactnative.ReactNativeLoadingMonitorKt.resolveListenerClass(ReactNativeLoadingMonitor.kt:128)\n\tat com.wix.detox.reactnative.ReactNativeLoadingMonitorKt.subscribeAsyncRNContextHandler(ReactNativeLoadingMonitor.kt:100)\n\tat com.wix.detox.reactnative.ReactNativeLoadingMonitorKt.access$subscribeAsyncRNContextHandler(ReactNativeLoadingMonitor.kt:1)\n\tat com.wix.detox.reactnative.ReactNativeLoadingMonitor$subscribeToNewRNContextUpdates$1.run(ReactNativeLoadingMonitor.kt:43)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:2223)\n\tat android.os.Handler.handleCallback(Handler.java:938)\n\tat android.os.Handler.dispatchMessage(Handler.java:99)\n\tat android.os.Looper.loop(Looper.java:223)\n\tat android.app.ActivityThread.main(ActivityThread.java:7656)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)\nCaused by: java.lang.ClassNotFoundException: Didn't find class \"com.facebook.react.ReactInstanceEventListener\" on path: DexPathList[[zip file \"\/system\/framework\/android.test.runner.jar\", zip file \"\/system\/framework\/android.test.mock.jar\", zip file \"\/system\/framework\/android.test.base.jar\", zip file \"\/data\/app\/~~CT0IuL1gs9CLtBL-G0PDvA==\/com.apple.mobileapp.beta.test-SZYRSnPNpRWBmbWNK1ONHA==\/base.apk\", zip file \"\/data\/app\/~~hEXOOCrlHLurxY-3QEve7Q==\/com.apple.mobileapp.beta-tjXmQEUTjyDtBgknhfyPxg==\/base.apk\"],nativeLibraryDirectories=[\/data\/app\/~~CT0IuL1gs9CLtBL-G0PDvA==\/com.apple.mobileapp.beta.test-SZYRSnPNpRWBmbWNK1ONHA==\/lib\/x86, \/data\/app\/~~hEXOOCrlHLurxY-3QEve7Q==\/com.apple.mobileapp.beta-tjXmQEUTjyDtBgknhfyPxg==\/lib\/x86, \/data\/app\/~~CT0IuL1gs9CLtBL-G0PDvA==\/com.apple.mobileapp.beta.test-SZYRSnPNpRWBmbWNK1ONHA==\/base.apk!\/lib\/x86, \/data\/app\/~~hEXOOCrlHLurxY-3QEve7Q==\/com.apple.mobileapp.beta-tjXmQEUTjyDtBgknhfyPxg==\/base.apk!\/lib\/x86, \/system\/lib, \/system_ext\/lib]]\n\tat dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:379)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:312)\n\t... 17 more\n\nCheck device logs for full details!"}} 00:03:17.302 detox[60927] WARN: [DetoxConnection.js/ERROR, #59292] Action dispatched too early, there is no session to use: HINT: Please report this issue on our GitHub tracker: https://github.com/wix/Detox/issues { messageId: -10000, type: 'AppWillTerminateWithError', params: [Object] } 00:03:17.302 detox[60927] TRACE: [WSS_GET_FROM, #59292] {"messageId":0,"type":"login","params":{"role":"app","sessionId":"800a1c18-30b8-3d69-d16a-4eb9824eb61e"}} 00:03:17.302 detox[60927] TRACE: [WSS_SEND_TO, #app] {"messageId":0,"type":"loginSuccess","params":{"testerConnected":true,"appConnected":true}} 00:03:17.302 detox[60927] TRACE: [SESSION_JOINED] app joined session 800a1c18-30b8-3d69-d16a-4eb9824eb61e 00:03:17.303 detox[60927] TRACE: [WSS_SEND_TO, #tester] {"type":"appConnected"} 00:03:17.303 detox[60927] TRACE: [WS_MESSAGE] {"type":"appConnected"} 00:03:17.305 detox[60927] TRACE: [WS_SEND] {"type":"isReady","params":{},"messageId":-1000} 00:03:17.305 detox[60927] TRACE: [WSS_GET_FROM, #tester] {"type":"isReady","params":{},"messageId":-1000} 00:03:17.306 detox[60927] TRACE: [WSS_SEND_TO, #app] {"type":"isReady","params":{},"messageId":-1000} 00:03:27.306 detox[60927] TRACE: [WS_SEND] {"type":"currentStatus","params":{},"messageId":1} 00:03:27.307 detox[60927] TRACE: [WSS_GET_FROM, #tester] {"type":"currentStatus","params":{},"messageId":1} 00:03:27.307 detox[60927] TRACE: [WSS_SEND_TO, #app] {"type":"currentStatus","params":{},"messageId":1} 00:03:27.337 detox[60927] TRACE: [WSS_GET_FROM, #app] {"messageId":1,"type":"currentStatusResult","params":{"status":{"app_status":"idle"}}} 00:03:27.338 detox[60927] TRACE: [WSS_SEND_TO, #tester] {"messageId":1,"type":"currentStatusResult","params":{"status":{"app_status":"idle"}}} 00:03:27.338 detox[60927] TRACE: [WS_MESSAGE] {"messageId":1,"type":"currentStatusResult","params":{"status":{"app_status":"idle"}}} 00:03:27.341 detox[60927] INFO: [APP_STATUS] The app seems to be idle 00:03:37.342 detox[60927] TRACE: [WS_SEND] {"type":"currentStatus","params":{},"messageId":2} 00:03:37.343 detox[60927] TRACE: [WSS_GET_FROM, #tester] {"type":"currentStatus","params":{},"messageId":2} 00:03:37.343 detox[60927] TRACE: [WSS_SEND_TO, #app] {"type":"currentStatus","params":{},"messageId":2} 00:03:37.351 detox[60927] TRACE: [WSS_GET_FROM, #app] {"messageId":2,"type":"currentStatusResult","params":{"status":{"app_status":"idle"}}} 00:03:37.351 detox[60927] TRACE: [WSS_SEND_TO, #tester] {"messageId":2,"type":"currentStatusResult","params":{"status":{"app_status":"idle"}}} 00:03:37.351 detox[60927] TRACE: [WS_MESSAGE] {"messageId":2,"type":"currentStatusResult","params":{"status":{"app_status":"idle"}}} ```Device logs
Device logs
``` paste logs here! ```More data, please!
No response