Closed kittichanr closed 1 year ago
this is detox log
Works locally but not on CI? I don't know what to do... 😕
Try running your app without Detox on your build agent. See if it crashes as well. You'll need to apply some knowledge with adb
commands (adb install
, adb shell am start
, and adb logcat
), but I hope you can manage. 🤔 (note to myself: Actually, it might be an interesting material for some troubleshooting article in the future).
Regardless, I'd try to set up debugging environment on your build agent, install Android studio, and try debugging it there (again, this is assuming that you can't reproduce locally). 🤷♂️
https://wix.github.io/Detox/docs/guide/debugging-in-android-studio
@petchkubb what is your CI provider? This is our Detox Android test (testing an Expo app) CI configuration for GitHub Actions:
https://github.com/upleveled/hotline-bling-codealong/blob/main/.github/workflows/detox-android.yml
You can see a (working) example test run here:
https://github.com/upleveled/hotline-bling-codealong/actions/runs/3343083014/jobs/5535942138
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions!
For more information on bots in this repository, read this discussion.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions!
For more information on bots in this repository, read this discussion.
The issue has been closed for inactivity.
Getting this error running detox v 20.0.5 on Bitrise
relevant bitrise.yml:
_build_android_detox:
steps:
- git-clone:
inputs:
- clone_depth: ''
title: Git Clone Repo
- npm@1.0.1:
inputs:
- command: install -g detox-cli
title: Install Detox CLI
- avd-manager@1.2.0:
inputs:
- abi: "x86_64"
- api_level: "31"
- profile: "pixel_4"
- emulator_id: "emulator"
- start_command_flags: "-no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none"
- wait-for-android-emulator@1:
- script@1.1.5:
inputs:
- content: "sudo apt-get update"
- script@1.1.5:
inputs:
- content: "sudo apt-get -y install qt5-default"
- script@1.1.5:
is_always_run: true
inputs:
- content: |-
#!/bin/bash
set -x
detox build --configuration android.emu.generic
title: Detox - Build Release App
- script@1.1.5:
inputs:
- content: "/opt/android-sdk-linux/platform-tools/adb -s emulator-5554 install -r android/app/build/outputs/apk/qa/release/app-qa-arm64-v8a-release-unsigned.apk"
- script@1.1.5:
is_always_run: true
inputs:
- content: |-
#!/bin/bash
set -x
export APP_MODE=mocked
detox test --configuration android.emu.generic e2e/Regression/helpCenter.e2e.ts --start
title: Detox - Test Release App
- deploy-to-bitrise-io@1.3.18: {}
Here's a thread dump from Bitrise. I also patched Detox to change the INSTALL_TIMEOUT to 6 mins.
+------------------------------------------------------------------------------+
| id: script |
| version: 1.1.5 |
| collection: https://github.com/bitrise-io/bitrise-steplib.git |
| toolkit: bash |
| time: 2023-03-13T16:30:23Z |
+------------------------------------------------------------------------------+
| |
+ export APP_MODE=mocked
+ APP_MODE=mocked
+ detox test --configuration android.emu.generic e2e/Regression/helpCenter.e2e.ts --start --record-logs all --loglevel debug --detectOpenHandles --debug-synchronization 5000
16:30:28.636 detox[7923] i ws-server Detox server listening on localhost:34693...
16:30:28.654 detox[7923] B lifecycle jest --config e2e/jest.config.ts --detectOpenHandles e2e/Regression/helpCenter.e2e.ts
16:30:33.037 detox[7923] B ws-server connection :34693<->:56970
16:30:33.198 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/emulator/emulator" -list-avds --verbose
16:30:33.257 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/emulator/emulator" -version
16:30:33.589 detox[7935] i device Detected emulator binary version { major: 31, minor: 3, patch: 14, toString: [Function: toString] }
16:30:33.591 detox[7935] i device:ALLOCATE_DEVICE Trying to allocate a device based on "emulator"
16:30:33.594 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" devices
16:30:33.619 detox[7935] i child-process:EXEC_SUCCESS List of devices attached
emulator-5554 device
16:30:33.642 detox[7935] i device:DEVICE_LOOKUP Found a matching & free device emulator-5554
16:30:33.646 detox[7935] i device:ALLOCATE_DEVICE Settled on emulator-5554
16:30:33.647 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "getprop dev.bootcomplete"
16:30:33.688 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "getprop ro.build.version.sdk"
16:30:33.720 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "settings put global animator_duration_scale 0"
16:30:33.763 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "settings put global window_animation_scale 0"
16:30:33.804 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "settings put global transition_animation_scale 0"
16:30:33.849 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "dumpsys power | grep \"^[ ]*m[UW].*=\""
16:30:33.958 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/build-tools/33.0.0/aapt" dump badging "/bitrise/src/android/app/build/outputs/apk/qa/debug/app-qa-x86_64-debug.apk"
16:30:33.997 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "pm list packages com.myapp.app.qa"
16:30:34.041 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 uninstall com.myapp.app.qa
16:30:34.236 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "pm list packages com.myapp.app.qa.test"
16:30:34.305 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "am force-stop com.myapp.app.qa"
16:30:34.358 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/build-tools/33.0.0/aapt" dump xmlstrings "/bitrise/src/android/app/build/outputs/apk/qa/debug/app-qa-x86_64-debug.apk" AndroidManifest.xml
16:30:34.384 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/build-tools/33.0.0/aapt" dump xmlstrings "/bitrise/src/android/app/build/outputs/apk/androidTest/qa/debug/app-qa-debug-androidTest.apk" AndroidManifest.xml
16:30:34.409 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "rm -fr /data/local/tmp/detox"
16:30:34.456 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "mkdir -p /data/local/tmp/detox"
16:30:34.503 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 push "/bitrise/src/android/app/build/outputs/apk/qa/debug/app-qa-x86_64-debug.apk" "/data/local/tmp/detox/Application.apk"
16:30:35.475 detox[7935] i child-process:SPAWN_CMD /opt/android-sdk-linux/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk
16:30:37.181 detox[7935] i child-process:SPAWN_END /opt/android-sdk-linux/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Application.apk exited with code #0
16:30:37.184 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 push "/bitrise/src/android/app/build/outputs/apk/androidTest/qa/debug/app-qa-debug-androidTest.apk" "/data/local/tmp/detox/Test.apk"
16:30:37.275 detox[7935] i child-process:SPAWN_CMD /opt/android-sdk-linux/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Test.apk
16:30:37.458 detox[7935] i child-process:SPAWN_END /opt/android-sdk-linux/platform-tools/adb -s emulator-5554 shell pm install -r -g -t /data/local/tmp/detox/Test.apk exited with code #0
16:30:37.461 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "am force-stop com.myapp.app.qa"
16:30:44.214 detox[7935] i child-process:SPAWN_CMD /opt/android-sdk-linux/platform-tools/adb -s emulator-5554 shell "logcat -f /sdcard/163033184_0.log"
16:30:44.230 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "am force-stop com.myapp.app.qa"
16:30:44.307 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "date +\"%m-%d %T.000\""
16:30:44.380 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 reverse tcp:34693 tcp:34693
16:30:44.423 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "pm list instrumentation"
16:30:44.535 detox[7935] i child-process:SPAWN_CMD /opt/android-sdk-linux/platform-tools/adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:34693 -e detoxSessionId 252b5613-e558-e969-b82e-4ba84d4ddd60 -e debug false com.myapp.app.qa.test/androidx.test.runner.AndroidJUnitRunner
16:30:44.540 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell du /sdcard/163033184_0.log
16:30:45.041 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "ps | grep \"com\.myapp\.app\.qa$\""
16:30:46.314 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell "date +\"%m-%d %T.000\""
16:30:46.402 detox[7935] i child-process:SPAWN_END /opt/android-sdk-linux/platform-tools/adb -s emulator-5554 shell "logcat -f /sdcard/163033184_0.log" terminated with SIGINT
16:30:46.439 detox[7935] i child-process:SPAWN_CMD /opt/android-sdk-linux/platform-tools/adb -s emulator-5554 shell "logcat -T \"03-13 16:30:45.000\" --pid=6834 -f /sdcard/163033184_0.log"
16:30:46.741 detox[7935] i child-process:EXEC_CMD "/opt/android-sdk-linux/platform-tools/adb" -s emulator-5554 shell du /sdcard/163033184_0.log
16:31:32.595 detox[7935] i child-process:SPAWN_END /opt/android-sdk-linux/platform-tools/adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:34693 -e detoxSessionId 252b5613-e558-e969-b82e-4ba84d4ddd60 -e debug false com.myapp.app.qa.test/androidx.test.runner.AndroidJUnitRunner exited with code #0
16:31:32.597 detox[7935] i device An error occurred while waiting for the app to become ready. Waiting for disconnection...
error: Failed to run application on the device
HINT: Most likely, your main activity has crashed prematurely.
Native stacktrace dump:
java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.myapp.app.qa/com.myapp.app.MainActivity (has extras) } within 45000 milliseconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1678725046008 and now the last time the queue went idle was: 1678725046201. If these numbers are the same your activity might be hogging the event queue.
at androidx.test.runner.MonitoringInstrumentation.startActivitySync(MonitoringInstrumentation.java:509)
at androidx.test.rule.ActivityTestRule.launchActivity(ActivityTestRule.java:376)
at com.wix.detox.Detox.runTests(Detox.java:140)
at com.wix.detox.Detox.runTests(Detox.java:103)
at com.myapp.app.DetoxTest.runDetoxTests(DetoxTest.java:34)```
This fixed my issue: gradle 7.2.2 https://stackoverflow.com/questions/72564710/react-native-crash-release-build-fatal-exception-create-react-context
Description
Hello, I need to ask some question. when I test android with emulator on local it find but when I run on CI it can't launch app in emulator on CI and got error like this for example
I have to tried many way for test on CI but didn't work yet. anyone could you help me please.
Your environment
Detox version: 19.12.1 React Native version: 0.69.5 Node version: 16 Device model: android emulator OS: linux Test-runner (select one): jest-circus