Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detox Android Crashing when launching app. #3773

Closed
2 tasks done
Osvaldo111 opened this issue Dec 21, 2022 · 6 comments
Closed
2 tasks done

Detox Android Crashing when launching app. #3773

Osvaldo111 opened this issue Dec 21, 2022 · 6 comments

Comments

@Osvaldo111
Copy link

What happened?

The app is crashing due to an idling issue related to the method "launchApp". In this case, the app is being loaded by Metro, and the app can be seen on the ADB device, the app is being opened and the welcome screen is seen for more than 30 seconds, but then the app crashes when trying to execute the tests.
image
image

What was the expected behaviour?

The first test case should be executed without any issue

Was it tested on latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: 20.1.0
React Native version: 0.63.4
Node version: 16.5.0
Device model: sdk_model_arm64 (Link)
Android version: 11
Test-runner (select one): jest

Detox logs

See complete logs here (running out of max chars here): https://pastebin.com/dnWd6wmn

Detox logs
12:08:51.149 detox[12414] B lifecycle node_modules/.bin/detox test --configuration android.att.debug --loglevel trace
  data: {
    "id": "eed90c5b-17ca-92b7-0afb-efb6965e9c84",
    "detoxConfig": {
      "configurationName": "android.att.debug",
      "apps": {
        "default": {
          "type": "android.apk",
          "binaryPath": "android/app/build/outputs/apk/movatic/debug/app-movatic-debug.apk",
          "build": "cd android ; ./gradlew assembleMovaticDebug assembleMovaticAndroidTest -DtestBuildType=debug ; cd -",
          "reversePorts": [
            8081
          ]
        }
      },
      "artifacts": {
        "rootDir": "artifacts/android.att.debug.2022-12-21 17-08-51Z",
        "plugins": {
          "log": {
            "enabled": false,
            "keepOnlyFailedTestsArtifacts": false
          },
          "screenshot": {
            "enabled": true,
            "shouldTakeAutomaticSnapshots": false,
            "keepOnlyFailedTestsArtifacts": false
          },
          "video": {
            "enabled": false,
            "keepOnlyFailedTestsArtifacts": false
          },
          "instruments": {
            "enabled": false,
            "keepOnlyFailedTestsArtifacts": false
          },
          "uiHierarchy": {
            "enabled": false,
            "keepOnlyFailedTestsArtifacts": false
          }
        }
      },
.....

Device logs

See the following Pastbin link for all of the logs (running out of max chars here): https://pastebin.com/4MFD2YQ9

Device logs
[
    {"ph":"M","args":{"name":"primary"},"ts":1671642768967000,"tid":0,"pid":12561,"name":"process_name"},
    {"ph":"M","args":{"sort_index":0},"ts":1671642768967000,"tid":0,"pid":12561,"name":"process_sort_index"},
    {"ph":"M","args":{"name":"lifecycle"},"ts":1671642768967000,"tid":0,"pid":12561,"name":"thread_name"},
    {"ph":"M","args":{"sort_index":0},"ts":1671642768967000,"tid":0,"pid":12561,"name":"thread_sort_index"},
    {"ph":"B","name":"node_modules/.bin/detox test --configuration android.att.debug --record-logs all","pid":12561,"tid":0,"cat":"lifecycle","ts":1671642768967000,"args":{"level":10,"cwd":"/Users/osvaldocarrillo/Desktop/Movatic/user-app","data":{"id":"5acc26d1-bf0b-ec5c-8057-65f1b7d2e48d","detoxConfig":{"configurationName":"android.att.debug","apps":{"default":{"type":"android.apk","binaryPath":"android/app/build/outputs/apk/movatic/debug/app-movatic-debug.apk","build":"cd android ; ./gradlew assembleMovaticDebug assembleMovaticAndroidTest -DtestBuildType=debug ; cd -","reversePorts":[8081]}},"artifacts":{"rootDir":"artifacts/android.att.debug.2022-12-21 17-12-48Z","plugins":{"log":{"enabled":true,"keepOnlyFailedTestsArtifacts":false},"screenshot":{"enabled":true,"shouldTakeAutomaticSnapshots":false,"keepOnlyFailedTestsArtifacts":false},"video":{"enabled":false,"keepOnlyFailedTestsArtifacts":false},"instruments":{"enabled":false,"keepOnlyFailedTestsArtifacts":false},"uiHierarchy":{"enabled":false,"keepOnlyFailedTestsArtifacts":false}}},"behavior":{"init":{"keepLockFile":false,"reinstallApp":true,"exposeGlobals":true},"cleanup":{"shutdownDevice":false},"launchApp":"auto"},"cli":{"recordLogs":"all","configuration":"android.att.debug"},"device":{"type":"android.attached","device":{"adbName":".*"}},"logger":{"level":"info","overrideConsole":true,"options":{"showLoggerName":true,"showPid":true,"showLevel":false,"showMetadata":false,"basepath":"/Users/osvaldocarrillo/Desktop/Movatic/user-app/node_modules/detox/src","prefixers":{},"stringifiers":{}}},"testRunner":{"retries":0,"forwardEnv":false,"bail":false,"jest":{"setupTimeout":120000,"teardownTimeout":30000,"retryAfterCircusRetries":false,"reportWorkerAssign":true},"args":{"$0":"jest","_":[],"config":"e2e/jest.config.js","--":[]}},"session":{"autoStart":true,"debugSynchronization":10000}},"detoxIPCServer":"primary-12561","testResults":[],"testSessionIndex":0,"workersCount":0},"v":0}},
    {"ph":"M","args":{"name":"ipc"},"ts":1671642768972000,"tid":1,"pid":12561,"name":"thread_name"},
    {"ph":"M","args":{"sort_index":1},"ts":1671642768972000,"tid":1,"pid":12561,"name":"thread_sort_index"},
    {"ph":"i","name":"Server path not specified, so defaulting to ipc.config.socketRoot + ipc.config.appspace + ipc.config.id /tmp/detox.primary-12561","pid":12561,"tid":1,"cat":"ipc,ipc-server","ts":1671642768972000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"starting server on  /tmp/detox.primary-12561 ","pid":12561,"tid":1,"cat":"ipc,ipc-server","ts":1671642768972000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"starting TLS server false","pid":12561,"tid":1,"cat":"ipc,ipc-server","ts":1671642768972000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"starting server as Unix || Windows Socket","pid":12561,"tid":1,"cat":"ipc,ipc-server","ts":1671642768972000,"args":{"level":10,"v":0}},
    {"ph":"M","args":{"name":"ws-server"},"ts":1671642768976000,"tid":2,"pid":12561,"name":"thread_name"},
    {"ph":"M","args":{"sort_index":2},"ts":1671642768976000,"tid":2,"pid":12561,"name":"thread_sort_index"},
    {"ph":"i","name":"Detox server listening on localhost:60076...","pid":12561,"tid":2,"cat":"ws-server,ws","ts":1671642768976000,"args":{"level":20,"v":0}},
    {"ph":"i","name":"Serialized the session state at: /private/var/folders/r9/1jr4wnk13s530164cggr5pvm0000gn/T/5acc26d1-bf0b-ec5c-8057-65f1b7d2e48d.detox.json","pid":12561,"tid":0,"cat":"lifecycle","ts":1671642768977000,"args":{"level":10,"v":0}},
    {"ph":"B","name":"jest --config e2e/jest.config.js","pid":12561,"tid":0,"cat":"lifecycle,cli","ts":1671642768978000,"args":{"level":30,"env":{},"v":0}},
    {"ph":"M","args":{"name":"secondary"},"ts":1671642769593000,"tid":0,"pid":12562,"name":"process_name"},
    {"ph":"M","args":{"sort_index":1},"ts":1671642769593000,"tid":0,"pid":12562,"name":"process_sort_index"},
    {"ph":"M","args":{"name":"ipc"},"ts":1671642769593000,"tid":5,"pid":12562,"name":"thread_name"},
    {"ph":"M","args":{"sort_index":5},"ts":1671642769593000,"tid":5,"pid":12562,"name":"thread_sort_index"},
    {"ph":"i","name":"Service path not specified, so defaulting to ipc.config.socketRoot + ipc.config.appspace + id ","pid":12562,"tid":5,"cat":"ipc","ts":1671642769593000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"requested connection to  primary-12561 /tmp/detox.primary-12561","pid":12562,"tid":5,"cat":"ipc","ts":1671642769593000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"Connecting client on Unix Socket : /tmp/detox.primary-12561","pid":12562,"tid":5,"cat":"ipc","ts":1671642769593000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"## socket connection to server detected ##","pid":12561,"tid":1,"cat":"ipc,ipc-server","ts":1671642769594000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"retrying reset","pid":12562,"tid":5,"cat":"ipc","ts":1671642769594000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"dispatching event to  primary-12561 /tmp/detox.primary-12561  :  registerContext , { id: 'secondary-12562' }","pid":12562,"tid":5,"cat":"ipc","ts":1671642769595000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"received event of :  registerContext { id: 'secondary-12562' }","pid":12561,"tid":1,"cat":"ipc,ipc-server","ts":1671642769596000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"dispatching event to socket  :  registerContextDone { testResults: [], testSessionIndex: 0 }","pid":12561,"tid":1,"cat":"ipc,ipc-server","ts":1671642769596000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"## received events ##","pid":12562,"tid":5,"cat":"ipc","ts":1671642769596000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"detected event registerContextDone { testResults: [], testSessionIndex: 0 }","pid":12562,"tid":5,"cat":"ipc","ts":1671642769597000,"args":{"level":10,"v":0}},
    {"ph":"M","args":{"name":"lifecycle"},"ts":1671642769682000,"tid":6,"pid":12562,"name":"thread_name"},
    {"ph":"M","args":{"sort_index":6},"ts":1671642769682000,"tid":6,"pid":12562,"name":"thread_sort_index"},
    {"ph":"B","name":"e2e/starter.test.js","pid":12562,"tid":6,"cat":"lifecycle,jest-environment","ts":1671642769682000,"args":{"level":10,"v":0}},
    {"ph":"B","name":"set up environment","pid":12562,"tid":6,"cat":"lifecycle,jest-environment","ts":1671642769693000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"dispatching event to  primary-12561 /tmp/detox.primary-12561  :  registerWorker , { workerId: 'w1' }","pid":12562,"tid":5,"cat":"ipc","ts":1671642769693000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"received event of :  registerWorker { workerId: 'w1' }","pid":12561,"tid":1,"cat":"ipc,ipc-server","ts":1671642769694000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"dispatching event to socket  :  registerWorkerDone { workersCount: 1 }","pid":12561,"tid":1,"cat":"ipc,ipc-server","ts":1671642769694000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"broadcasting event to all known sockets listening to  /tmp/detox.primary-12561  :   sessionStateUpdate { workersCount: 1 }","pid":12561,"tid":1,"cat":"ipc,ipc-server","ts":1671642769694000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"## received events ##","pid":12562,"tid":5,"cat":"ipc","ts":1671642769694000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"detected event registerWorkerDone { workersCount: 1 }","pid":12562,"tid":5,"cat":"ipc","ts":1671642769694000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"## received events ##","pid":12562,"tid":5,"cat":"ipc","ts":1671642769778000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"detected event sessionStateUpdate { workersCount: 1 }","pid":12562,"tid":5,"cat":"ipc","ts":1671642769778000,"args":{"level":10,"v":0}},
    {"ph":"B","name":"connection :60076<->:60078","pid":12561,"tid":2,"cat":"ws-server,ws","ts":1671642769780000,"args":{"level":20,"id":60078,"v":0}},
    {"ph":"M","args":{"name":"ws-client"},"ts":1671642769781000,"tid":7,"pid":12562,"name":"thread_name"},
    {"ph":"M","args":{"sort_index":7},"ts":1671642769781000,"tid":7,"pid":12562,"name":"thread_sort_index"},
    {"ph":"i","name":"opened web socket to: ws://localhost:60076","pid":12562,"tid":7,"cat":"ws-client,ws","ts":1671642769781000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"get","pid":12561,"tid":2,"cat":"ws-server,ws","ts":1671642769782000,"args":{"level":10,"id":60078,"data":"{\"type\":\"login\",\"params\":{\"sessionId\":\"0be94ff6-cbdd-e65c-0756-f48f82120a6d\",\"role\":\"tester\"},\"messageId\":0}","v":0}},
    {"ph":"i","name":"send message","pid":12562,"tid":7,"cat":"ws-client,ws","ts":1671642769782000,"args":{"level":10,"data":"{\"type\":\"login\",\"params\":{\"sessionId\":\"0be94ff6-cbdd-e65c-0756-f48f82120a6d\",\"role\":\"tester\"},\"messageId\":0}","v":0}},
    {"ph":"M","args":{"name":"ws-server"},"ts":1671642769783000,"tid":3,"pid":12561,"name":"thread_name"},
    {"ph":"M","args":{"sort_index":3},"ts":1671642769783000,"tid":3,"pid":12561,"name":"thread_sort_index"},
    {"ph":"i","name":"created session 0be94ff6-cbdd-e65c-0756-f48f82120a6d","pid":12561,"tid":3,"cat":"ws-server,ws-session","ts":1671642769783000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"send","pid":12561,"tid":2,"cat":"ws-server,ws","ts":1671642769783000,"args":{"level":10,"id":60078,"trackingId":"tester","sessionId":"0be94ff6-cbdd-e65c-0756-f48f82120a6d","role":"tester","data":{"type":"loginSuccess","params":{"testerConnected":true,"appConnected":false},"messageId":0},"v":0}},
    {"ph":"i","name":"tester joined session 0be94ff6-cbdd-e65c-0756-f48f82120a6d","pid":12561,"tid":3,"cat":"ws-server,ws-session","ts":1671642769783000,"args":{"level":10,"v":0}},
    {"ph":"i","name":"get message","pid":12562,"tid":7,"cat":"ws-client,ws","ts":1671642769783000,"args":{"level":10,"data":"{\"type\":\"loginSuccess\",\"params\":{\"testerConnected\":true,\"appConnected\":false},\"messageId\":0}\n ","v":0}},
    {"ph":"M","args":{"name":"device"},"ts":1671642769814000,"tid":8,"pid":12562,"name":"thread_name"},
    {"ph":"M","args":{"sort_index":8},"ts":1671642769814000,"tid":8,"pid":12562,"name":"thread_sort_index"},
    {"ph":"B","name":"allocate","pid":12562,"tid":8,"cat":"device","ts":1671642769814000,"args":{"level":10,"args":[{"type":"android.attached","device":{"adbName":".*"}}],"v":0}},
    {"ph":"M","args":{"name":"child-process"},"ts":1671642769814000,"tid":9,"pid":12562,"name":"thread_name"},
    {"ph":"M","args":{"sort_index":9},"ts":1671642769814000,"tid":9,"pid":12562,"name":"thread_sort_index"},
    {"ph":"i","name":"\"/Users/osvaldocarrillo/Library/Android/sdk/platform-tools/adb\"  devices","pid":12562,"tid":9,"cat":"child-process,child-process-exec","ts":1671642769814000,"args":{"level":20,"fn":"execWithRetriesAndLogs","cmd":"\"/Users/osvaldocarrillo/Library/Android/sdk/platform-tools/adb\"  devices","trackingId":0,"event":"EXEC_CMD","v":0}},

More data, please!

No response

@d4vidi
Copy link
Collaborator

d4vidi commented Jan 11, 2023

The error you've described suggests your app remains busy even though the main screen is visible, and therefore the app-launching part, which awaits idle, never resolves.

@github-actions
Copy link

This issue appears to be a general usage or support question.
In order to get help, please either ask a question on Stack Overflow with the detox tag, or simply join our Discord.
Feel free to post your Stack Overflow question here for more visibility! We'll take a look at it ASAP.
For more information about our policy on issues, refer to this discussion.

@FadiAboMsalam
Copy link

@Osvaldo111 am facing same issue only on android, iOS working fine
any ideas would be much helpful

@d4vidi adb logs shows
FATAL EXCEPTION: detox.primary Process: com.safarway.app, PID: 32308 java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/espresso/IdlingRegistry;

any ideas what to do it has been couple of days that am stuck

@d4vidi
Copy link
Collaborator

d4vidi commented Jan 12, 2023

@FadiAboMsalam You have to reiterate the Android setup guide. Looks like something's slipped away.

@FadiAboMsalam
Copy link

@d4vidi just for anyone else facing the issue
turning minifyEnabled & shrinkResources to false made the test work

I am not sure why though

@d4vidi
Copy link
Collaborator

d4vidi commented Jan 16, 2023

@FadiAboMsalam Actually that's not a good advice. Minification is commonly necessary in release-mode apps, and should not be removed altogether. Rather, one should do so while following our ProGuard guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants