wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.13k stars 1.92k forks source link

Error: No instrumentation runner found on device emulator-19386 for package com.package.flavour.test #2436

Closed AngeloMateus closed 3 years ago

AngeloMateus commented 3 years ago

Describe the bug Followed the instructions and tried to fix this for several days. Running debug test shows Error: No instrumentation runner found on device emulator-19386 for package com.package.flavor.test I'm using flavours.

There are several issues on this that are closed with your bot, with seemingly no answer.

To Reproduce Use flavours and follow the documentation.

Use testBinaryPath because for some reason just having the binaryPath, Detox doesn't just read it, it adds random folders in the middle of the path you defined:

binaryPath: android/app/build/outputs/apk/androidTest/flavour/debug/app-flavour-debug-androidTest.apk

Error: android/app/build/outputs/apk/androidTest/androidTest/WorkcoDebug/androidTest/app-Workco-debug-androidTest-androidTest.apk' could not be found, did you run './gradlew assembleAndroidTest'?

With testBinaryPath it uses the correct path but you have to have binaryPath set as well for some reason.

Steps to reproduce:

  1. Follow documentation
  2. Use on a flavour
  3. See it not work

Expected behavior

Tests run

Device and Verbose Detox Logs

detox[89859] DEBUG: [exec.js/EXEC_CMD, #11] "/Users/me/Library/Android/sdk/platform-tools/adb" -s emulator-19386 shell "pm list packages com.package.flavour.test.test"

Is this meant to have two test?

Environment (please complete the following information):

YakovTaranis commented 3 years ago

Same issue happened while using Pixel_3 and Pixel_4 mobile emulators with Android 10. Execution of "detox test --configuration android.sim" command failed with error Error: No instrumentation runner found on device emulator-12620 for package host.exp.exponent

symmetriccurve commented 3 years ago

Error: No instrumentation runner found on device emulator-5444. having same issue

Julienblc commented 3 years ago

Error: No instrumentation runner found on device emulator-11498 Same issue here, with Pixel 4 emulator and an Expo app.

Any solution ?

esantamarialago-sh commented 3 years ago

Same error here, with all emulators. Everything is done like the guide but it doesn't work. Any news? Thanks!

d4vidi commented 3 years ago

@AngeloMateus thanks for reporting this.

First, regarding -

There are several issues on this that are closed with your bot, with seemingly no answer.

Please bear in mind that this is an open source project. We try our best to maintain it, yet we can only go as far as our limited resources allow us to. We highly appreciate pull requests from those using the project.

As for the actual error:

Error: No instrumentation runner found on device emulator-19386 for package com.package.flavor.test

I couldn't reason whether you have issues with installing the test APK, or that the error you posted occurs nonetheless. It'd be much easier to help if you attach the complete logs running in log-level trace, as requested in the issue template. In any case, since you've mentioned flavours -- please double check that indeed the test APK associated with your error does contain the code in your DetoxTest.java (e.g. drag & drop the APK to android studio), and that you havee proper definition of the test runner in app/build.gradle associated with that flavour.

Thanks

anderslundback commented 3 years ago

Hello, I'm having the same issue.

I have tried running on both an attached android device and various emulators. I have also tried with jest + jest-circus instead of mocha with various versions.

Following the advice of @d4vidi I have also verified that DetoxTest.java is in fact included in my apk. Please see detox logs below with log level: trace. Thank you for taking the time. Please let me know if I can provide any further information.

node: 14.4.0 java: 1.8.0_242 detox: 17.13.2 mocha: 6.1.3 react: 16.13.1 react-native: 0.63.3

detox test -c android.emu.debug --loglevel trace
detox[13864] INFO:  [test.js] mocha --config e2e/.mocharc.json --configuration android.emu.debug --grep :ios: --invert --loglevel trace --use-custom-logger true e2e
detox[13866] INFO:  at node_modules/mocha/lib/reporters/spec.js:49:13 

detox[13866] INFO:  at node_modules/mocha/lib/reporters/spec.js:54:13 

detox[13866] TRACE: [Detox.js/DETOX_CREATE] created a Detox instance with config:
{"artifactsConfig":{"rootDir":"artifacts/android.emu.debug.2020-12-03 17-26-43Z","plugins":{"log":{"enabled":false,"keepOnlyFailedTestsArtifacts":false},"screenshot":{"enabled":true,"shouldTakeAutomaticSnapshots":false,"keepOnlyFailedTestsArtifacts":false},"video":{"enabled":false,"keepOnlyFailedTestsArtifacts":false},"instruments":{"enabled":false,"keepOnlyFailedTestsArtifacts":false},"timeline":{"enabled":false}},"pathBuilder":{"_rootDir":"artifacts/android.emu.debug.2020-12-03 17-26-43Z"}},"behaviorConfig":{"init":{"reinstallApp":true,"exposeGlobals":true,"launchApp":true},"cleanup":{"shutdownDevice":false}},"cliConfig":{"configuration":"android.emu.debug","loglevel":"trace","useCustomLogger":"true"},"deviceConfig":{"type":"android.emulator","binaryPath":"android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk","build":"cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -","device":{"avdName":"Pixel_API_28_AOSP"}},"runnerConfig":{"testRunner":"mocha","runnerConfig":"e2e/.mocharc.json","specs":"e2e"},"sessionConfig":{"autoStart":true,"server":"ws://localhost:54044","sessionId":"f51fb143-a12a-2cdf-ed2a-716b24182978","debugSynchronization":false},"errorBuilder":{"filepath":"/Users/anders/dev/projects/react-native/detoxrn/.detoxrc.json","contents":{"testRunner":"mocha","runnerConfig":"e2e/.mocharc.json","configurations":{"ios":{"type":"ios.simulator","binaryPath":"SPECIFY_PATH_TO_YOUR_APP_BINARY","device":{"type":"iPhone 11"}},"android.attached.release":{"type":"android.attached","testBinaryPath":"android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk","build":"cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..","device":{"avdName":"5200c794439ab5fd"}},"android.attached.debug":{"type":"android.attached","binaryPath":"android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk","build":"cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -","device":{"avdName":"5200c794439ab5fd"}},"android.emu.debug":{"type":"android.emulator","binaryPath":"android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk","build":"cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -","device":{"avdName":"Pixel_API_28_AOSP"}}}},"configurationName":"android.emu.debug"}}
detox[13866] INFO:  [DetoxServer.js] server listening on localhost:54044...
detox[13866] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:54044
detox[13866] TRACE: [AsyncWebSocket.js/WEBSOCKET_SEND] {"type":"login","params":{"sessionId":"f51fb143-a12a-2cdf-ed2a-716b24182978","role":"tester"},"messageId":0}
detox[13866] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=f51fb143-a12a-2cdf-ed2a-716b24182978
detox[13866] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=f51fb143-a12a-2cdf-ed2a-716b24182978
detox[13866] TRACE: [AsyncWebSocket.js/WEBSOCKET_MESSAGE] {"type":"loginSuccess","params":{"sessionId":"f51fb143-a12a-2cdf-ed2a-716b24182978","role":"tester"},"messageId":0}

detox[13866] DEBUG: [exec.js/EXEC_CMD, #0] "/Users/anders/Library/Android/sdk/emulator/emulator" -list-avds --verbose
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #0] Nexus_5X_API_29_x86
Nexus_7_API_28
Pixel_2_API_29
Pixel_API_28_AOSP

detox[13866] DEBUG: [exec.js/EXEC_CMD, #1] "/Users/anders/Library/Android/sdk/emulator/emulator" -version 
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #1] Android emulator version 30.2.6.0 (build_id 6962233) (CL:N/A)
Copyright (C) 2006-2017 The Android Open Source Project and many others.
This program is a derivative of the QEMU CPU emulator (www.qemu.org).

  This software is licensed under the terms of the GNU General Public
  License version 2, as published by the Free Software Foundation, and
  may be copied, distributed, and modified under those terms.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

detox[13866] DEBUG: [EmulatorVersionResolver.js/EMU_BIN_VERSION_DETECT] Detected emulator binary version { major: 30, minor: 2, patch: 6, toString: [Function: toString] }
detox[13866] DEBUG: [EmulatorDeviceAllocator.js/ALLOCATE_DEVICE] Trying to allocate a device based on "Pixel_API_28_AOSP"
detox[13866] DEBUG: [exec.js/EXEC_CMD, #2] "/Users/anders/Library/Android/sdk/platform-tools/adb"  devices
detox[13866] DEBUG: [exec.js/EXEC_SUCCESS, #2] List of devices attached
emulator-13294  device

detox[13866] TRACE: [EmulatorTelnet.js/TELNET_CONNECTING] port: 13294, host: localhost
detox[13866] DEBUG: [FreeDeviceFinder.js/DEVICE_LOOKUP] Found a matching & free device emulator-13294
detox[13866] DEBUG: [EmulatorDeviceAllocator.js/ALLOCATE_DEVICE] Settled on emulator-13294
detox[13866] DEBUG: [exec.js/EXEC_CMD, #3] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "getprop dev.bootcomplete"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #3] 1

detox[13866] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBootDevice({
  coldBoot: false,
  deviceId: 'emulator-13294',
  type: 'Pixel_API_28_AOSP'
})
detox[13866] DEBUG: [exec.js/EXEC_CMD, #4] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "getprop ro.build.version.sdk"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #4] 28

detox[13866] DEBUG: [exec.js/EXEC_CMD, #5] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "settings put global animator_duration_scale 0"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #5] 
detox[13866] DEBUG: [exec.js/EXEC_CMD, #6] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "settings put global window_animation_scale 0"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #6] 
detox[13866] DEBUG: [exec.js/EXEC_CMD, #7] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "settings put global transition_animation_scale 0"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #7] 
detox[13866] DEBUG: [exec.js/EXEC_CMD, #8] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "dumpsys power | grep \"^[ ]*m[UW].*=\""
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #8]   mWakefulness=Awake
  mWakefulnessChanging=false
  mWakeLockSummary=0x0
  mUserActivitySummary=0x1
  mWakeUpWhenPluggedOrUnpluggedConfig=false
  mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig=false
  mUserActivityTimeoutOverrideFromWindowManager=-1
  mUserInactiveOverrideFromWindowManager=false

detox[13866] DEBUG: [exec.js/EXEC_CMD, #9] "/Users/anders/Library/Android/sdk/build-tools/29.0.3/aapt" dump badging "/Users/anders/dev/projects/react-native/detoxrn/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk" | grep -e "package: name="
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #9] package: name='com.detoxrn.test' versionCode='' versionName='' compileSdkVersion='29' compileSdkVersionCodename='10'

detox[13866] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeUninstallApp({ deviceId: 'emulator-13294', bundleId: 'com.detoxrn.test' })
detox[13866] DEBUG: [exec.js/EXEC_CMD, #10] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "pm list packages com.detoxrn.test"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #10] package:com.detoxrn.test

detox[13866] DEBUG: [exec.js/EXEC_CMD, #11] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 uninstall com.detoxrn.test
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #11] Success

detox[13866] DEBUG: [exec.js/EXEC_CMD, #12] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "pm list packages com.detoxrn.test.test"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #12] 
detox[13866] DEBUG: [exec.js/EXEC_CMD, #13] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "rm -fr /data/local/tmp/detox"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #13] 
detox[13866] DEBUG: [exec.js/EXEC_CMD, #14] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "mkdir -p /data/local/tmp/detox"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #14] 
detox[13866] DEBUG: [exec.js/EXEC_CMD, #15] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 push "/Users/anders/dev/projects/react-native/detoxrn/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk" "/data/local/tmp/detox/Application.apk"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #15] /Users/anders/dev/projects/react-native/detoxrn/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk: 1 file pushed. 8.2 MB/s (1307924 bytes in 0.153s)

detox[13866] DEBUG: [exec.js/EXEC_CMD, #16] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "pm install -r -g -t /data/local/tmp/detox/Application.apk"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #16] Success

detox[13866] DEBUG: [exec.js/EXEC_CMD, #17] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 push "/Users/anders/dev/projects/react-native/detoxrn/android/app/build/outputs/apk/androidTest/debug/androidTest/app-debug-androidTest-androidTest.apk" "/data/local/tmp/detox/Test.apk"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #17] /Users/anders/dev/projects/react-native/detoxrn/android/app/build/outputs/apk/androidTest/debug/androidTest/app-debug-androidTest-androidTest.apk: 1 file pushed. 13.8 MB/s (1307900 bytes in 0.090s)

detox[13866] DEBUG: [exec.js/EXEC_CMD, #18] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "pm install -r -g -t /data/local/tmp/detox/Test.apk"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #18] Success

detox[13866] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeTerminateApp({ deviceId: 'emulator-13294', bundleId: 'com.detoxrn.test' })
detox[13866] DEBUG: [exec.js/EXEC_CMD, #19] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "am force-stop com.detoxrn.test"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #19] 
detox[13866] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onTerminateApp({ deviceId: 'emulator-13294', bundleId: 'com.detoxrn.test' })
detox[13866] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeLaunchApp({
  deviceId: 'emulator-13294',
  bundleId: 'com.detoxrn.test',
  launchArgs: {
    detoxServer: 'ws://localhost:54044',
    detoxSessionId: 'f51fb143-a12a-2cdf-ed2a-716b24182978'
  }
})
detox[13866] DEBUG: [exec.js/EXEC_CMD, #20] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "date +\"%m-%d %T.000\""
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #20] 12-03 17:27:00.000

detox[13866] DEBUG: [exec.js/EXEC_CMD, #21] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 reverse tcp:54044 tcp:54044
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #21] 
detox[13866] DEBUG: [exec.js/EXEC_CMD, #22] "/Users/anders/Library/Android/sdk/platform-tools/adb" -s emulator-13294 shell "pm list instrumentation"
detox[13866] TRACE: [exec.js/EXEC_SUCCESS, #22] instrumentation:com.detoxrn.test/androidx.test.runner.AndroidJUnitRunner (target=com.detoxrn)
instrumentation:org.chromium.webview_shell/.WebViewLayoutTestRunner (target=org.chromium.webview_shell)

detox[13866] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR] 
 Error: No instrumentation runner found on device emulator-13294 for package com.detoxrn.test
    at ADB.getInstrumentationRunner (/Users/anders/dev/projects/react-native/detoxrn/node_modules/detox/src/devices/drivers/android/exec/ADB.js:250:13)
    at async Instrumentation.launch (/Users/anders/dev/projects/react-native/detoxrn/node_modules/detox/src/devices/drivers/android/tools/Instrumentation.js:19:24)
    at async MonitoredInstrumentation.launch (/Users/anders/dev/projects/react-native/detoxrn/node_modules/detox/src/devices/drivers/android/tools/MonitoredInstrumentation.js:18:5)
    at async EmulatorDriver._launchInstrumentationProcess (/Users/anders/dev/projects/react-native/detoxrn/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:256:5)
    at async EmulatorDriver._launchApp (/Users/anders/dev/projects/react-native/detoxrn/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:237:7)
    at async EmulatorDriver.launchApp (/Users/anders/dev/projects/react-native/detoxrn/node_modules/detox/src/devices/drivers/android/AndroidDriver.js:95:5)
    at async Device.launchApp (/Users/anders/dev/projects/react-native/detoxrn/node_modules/detox/src/devices/Device.js:64:23)
    at async Detox._doInit (/Users/anders/dev/projects/react-native/detoxrn/node_modules/detox/src/Detox.js:188:7)
detox[13866] INFO:  at node_modules/mocha/lib/reporters/spec.js:88:13 
   1) "before all" hook in "{root}"
detox[13866] TRACE: [ArtifactsManager.js/LIFECYCLE] artifactsManager.onBeforeCleanup()
detox[13866] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=f51fb143-a12a-2cdf-ed2a-716b24182978
detox[13866] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
detox[13866] INFO:  at node_modules/mocha/lib/reporters/base.js:311:11 

detox[13866] INFO:  at node_modules/mocha/lib/reporters/base.js:319:11 
   0 passing (18s)
detox[13866] INFO:  at node_modules/mocha/lib/reporters/base.js:332:13 
   1 failing
detox[13866] INFO:  at node_modules/mocha/lib/reporters/base.js:195:11 

detox[13866] INFO:  at node_modules/mocha/lib/reporters/base.js:256:13 
   1) "before all" hook in "{root}":
     Error: No instrumentation runner found on device emulator-13294 for package com.detoxrn.test
      at ADB.getInstrumentationRunner (node_modules/detox/src/devices/drivers/android/exec/ADB.js:250:13)
      at async Instrumentation.launch (node_modules/detox/src/devices/drivers/android/tools/Instrumentation.js:19:24)
      at async MonitoredInstrumentation.launch (node_modules/detox/src/devices/drivers/android/tools/MonitoredInstrumentation.js:18:5)
      at async EmulatorDriver._launchInstrumentationProcess (node_modules/detox/src/devices/drivers/android/AndroidDriver.js:256:5)
      at async EmulatorDriver._launchApp (node_modules/detox/src/devices/drivers/android/AndroidDriver.js:237:7)
      at async EmulatorDriver.launchApp (node_modules/detox/src/devices/drivers/android/AndroidDriver.js:95:5)
      at async Device.launchApp (node_modules/detox/src/devices/Device.js:64:23)
      at async Detox._doInit (node_modules/detox/src/Detox.js:188:7)

detox[13866] INFO:  at node_modules/mocha/lib/reporters/base.js:335:13 

detox[13866] INFO:  at node_modules/mocha/lib/reporters/base.js:338:11 

detox[13864] ERROR: [cli.js] Error: Command failed: mocha --config e2e/.mocharc.json --configuration android.emu.debug --grep :ios: --invert --loglevel trace --use-custom-logger true e2e
d4vidi commented 3 years ago

@anderslundback could you copy&paste your Detox configuration here? According to the logs (and detox code), you've erroneously used your test APK for your app's APK under binaryPath. Please double check that.

anderslundback commented 3 years ago

@d4vidi thank you, I'm looking into it. Here's my detox config:

{
  "testRunner": "mocha",
  "runnerConfig": "e2e/.mocharc.json",
  "configurations": {
    "ios": {
      "type": "ios.simulator",
      "binaryPath": "SPECIFY_PATH_TO_YOUR_APP_BINARY",
      "device": {
        "type": "iPhone 11"
      }
    },
    "android.attached.release": {
      "type": "android.attached",
      "testBinaryPath": "android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk",
      "build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
      "device": {
        "avdName": "5200c794439ab5fd"
      }
    },
    "android.attached.debug": {
      "type": "android.attached",
      "binaryPath": "android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk",
      "build": "cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -",
      "device": {
        "avdName": "5200c794439ab5fd"
      }
    },
    "android.emu.debug": {
      "type": "android.emulator",
      "binaryPath": "android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk",
      "build": "cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -",
      "device": {
        "avdName": "Pixel_API_28_AOSP"
      }
    }
  }
}
d4vidi commented 3 years ago

Yes, that indeed confirms it:

      "binaryPath": "android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk",

Change it to your app APK's path.

noomorph commented 3 years ago

@d4vidi, I just wonder if we can detect this case automatically via some apktool analysis or similar?

d4vidi commented 3 years ago

Yes, sounds feasible

yasemincidem commented 3 years ago

I solved this issue by changing the android configuration as follows. It helps to solve your issue.

 "android.debug": {
      "type": "android.apk",
      "binaryPath": "android/app/build/outputs/apk/debug/app-x86-debug.apk",
      "testBinaryPath": "android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk",
      "build": "cd android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug && cd .."
 }

Please be sure that binaryPath indicates your app APK's path and testBinaryPath indicates your androidTest APK's path.

cristian-montejano commented 2 years ago

I solved this issue by changing the android configuration as follows. It helps to solve your issue.

 "android.debug": {
      "type": "android.apk",
      "binaryPath": "android/app/build/outputs/apk/debug/app-x86-debug.apk",
      "testBinaryPath": "android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk",
      "build": "cd android && ./gradlew app:assembleDebug app:assembleAndroidTest -DtestBuildType=debug && cd .."
 }

Please be sure that binaryPath indicates your app APK's path and testBinaryPath indicates your androidTest APK's path.

this worked for me! thank you!

FrozenPyrozen commented 2 years ago

Got the same issue, no app on android emulator

java version: "11.0.14-zulu" detox version "19.6.5" node version: "v16.13.1" react-native: "~0.63.4"

'android.release': {
      type: 'android.apk',
      binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
      testBinaryPath: 'android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk',
      build:
        'cd android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release && cd ..',
    },

With trace:

 npx detox test -c android --loglevel trace
10:51:19.607 detox[29651] INFO:  [test.js] DETOX_CONFIGURATION="android" DETOX_LOGLEVEL="trace" DETOX_REPORT_SPECS=true DETOX_START_TIMESTAMP=1650009079604 DETOX_USE_CUSTOM_LOGGER=true jest --config e2e/jest-runner-config.js --testNamePattern '^((?!:ios:).)*$' e2e
10:51:20.829 detox[29652] TRACE: [DETOX_CREATE] created a Detox instance with config:
{
  appsConfig: {
    default: {
      type: 'android.apk',
      binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
      testBinaryPath: 'android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk',
      build: 'cd android && ./gradlew app:assembleRelease app:assembleAndroidTest -DtestBuildType=release && cd ..'
    }
  },
  artifactsConfig: {
    rootDir: 'artifacts/android.2022-04-15 07-51-19Z',
    plugins: {
      log: {
        enabled: false,
        keepOnlyFailedTestsArtifacts: false
      },
      screenshot: {
        shouldTakeAutomaticSnapshots: true,
        keepOnlyFailedTestsArtifacts: true,
        takeWhen: {
          testStart: false,
          testFails: true,
          testDone: false
        },
        enabled: true
      },
      video: {
        android: {
          bitRate: 4000000
        },
        simulator: {
          codec: 'hevc'
        },
        enabled: false,
        keepOnlyFailedTestsArtifacts: false
      },
      instruments: {
        enabled: true,
        keepOnlyFailedTestsArtifacts: false
      },
      timeline: {
        enabled: false
      },
      uiHierarchy: {
        enabled: false,
        keepOnlyFailedTestsArtifacts: false
      }
    },
    pathBuilder: ArtifactPathBuilder {
      _rootDir: 'artifacts/android.2022-04-15 07-51-19Z'
    }
  },
  behaviorConfig: {
    init: {
      reinstallApp: false,
      exposeGlobals: true
    },
    cleanup: {
      shutdownDevice: false
    },
    launchApp: 'auto'
  },
  cliConfig: {
    configuration: 'android',
    loglevel: 'trace',
    useCustomLogger: true
  },
  configurationName: 'android',
  deviceConfig: {
    type: 'android.emulator',
    device: {
      avdName: 'Pixel_XL_API_30_AOSP'
    }
  },
  runnerConfig: {
    testRunner: 'jest',
    runnerConfig: 'e2e/jest-runner-config.js',
    specs: 'e2e',
    skipLegacyWorkersInjection: true
  },
  sessionConfig: {
    autoStart: true,
    sessionId: '53f02e01-4052-92eb-eb3a-102c5dbcbf8b',
    debugSynchronization: 10000
  }
}
10:51:20.832 detox[29652] DEBUG: [WSS_CREATE] Detox server listening on localhost:56944...
10:51:20.840 detox[29652] DEBUG: [WSS_CONNECTION, #56945] registered a new connection.
10:51:20.841 detox[29652] TRACE: [WS_OPEN] opened web socket to: ws://localhost:56944
10:51:20.843 detox[29652] TRACE: [WS_SEND] {"type":"login","params":{"sessionId":"53f02e01-4052-92eb-eb3a-102c5dbcbf8b","role":"tester"},"messageId":0}
10:51:20.843 detox[29652] TRACE: [WSS_GET_FROM, #56945] {"type":"login","params":{"sessionId":"53f02e01-4052-92eb-eb3a-102c5dbcbf8b","role":"tester"},"messageId":0}
10:51:20.844 detox[29652] TRACE: [SESSION_CREATED] created session 53f02e01-4052-92eb-eb3a-102c5dbcbf8b
10:51:20.844 detox[29652] TRACE: [WSS_SEND_TO, #tester] {"type":"loginSuccess","params":{"testerConnected":true,"appConnected":false},"messageId":0}
10:51:20.844 detox[29652] TRACE: [SESSION_JOINED] tester joined session 53f02e01-4052-92eb-eb3a-102c5dbcbf8b
10:51:20.844 detox[29652] TRACE: [WS_MESSAGE] {"type":"loginSuccess","params":{"testerConnected":true,"appConnected":false},"messageId":0}

10:51:20.868 detox[29652] DEBUG: [EXEC_CMD, #0] "/Users/admin/Library/Android/sdk/emulator/emulator" -list-avds --verbose
10:51:20.900 detox[29652] TRACE: [EXEC_SUCCESS, #0] Pixel_5_API_30
Pixel_XL_API_30_AOSP

10:51:20.901 detox[29652] DEBUG: [EXEC_CMD, #1] "/Users/admin/Library/Android/sdk/emulator/emulator" -version 
10:51:20.957 detox[29652] TRACE: [EXEC_SUCCESS, #1] Android emulator version 31.2.9.0 (build_id 8316981) (CL:N/A)
Copyright (C) 2006-2017 The Android Open Source Project and many others.
This program is a derivative of the QEMU CPU emulator (www.qemu.org).

  This software is licensed under the terms of the GNU General Public
  License version 2, as published by the Free Software Foundation, and
  may be copied, distributed, and modified under those terms.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

10:51:20.957 detox[29652] DEBUG: [EMU_BIN_VERSION_DETECT] Detected emulator binary version { major: 31, minor: 2, patch: 9, toString: [Function: toString] }
10:51:20.958 detox[29652] DEBUG: [ALLOCATE_DEVICE] Trying to allocate a device based on "Pixel_XL_API_30_AOSP"
10:51:20.959 detox[29652] DEBUG: [EXEC_CMD, #2] "/Users/admin/Library/Android/sdk/platform-tools/adb"  devices
10:51:20.970 detox[29652] DEBUG: [EXEC_SUCCESS, #2] List of devices attached
emulator-13840  device

10:51:20.971 detox[29652] TRACE: [TELNET_CONNECTING] port: 13840, host: localhost
10:51:20.975 detox[29652] DEBUG: [DEVICE_LOOKUP] Found a matching & free device emulator-13840
10:51:20.976 detox[29652] DEBUG: [ALLOCATE_DEVICE] Settled on emulator-13840
10:51:20.976 detox[29652] DEBUG: [EXEC_CMD, #3] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "getprop dev.bootcomplete"
10:51:21.003 detox[29652] TRACE: [EXEC_SUCCESS, #3] 1

10:51:21.004 detox[29652] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onBootDevice({
  deviceId: 'emulator-13840',
  type: 'Pixel_XL_API_30_AOSP',
  coldBoot: false
})
10:51:21.004 detox[29652] DEBUG: [EXEC_CMD, #4] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "getprop ro.build.version.sdk"
10:51:21.025 detox[29652] TRACE: [EXEC_SUCCESS, #4] 30

10:51:21.025 detox[29652] DEBUG: [EXEC_CMD, #5] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "settings put global animator_duration_scale 0"
10:51:21.063 detox[29652] TRACE: [EXEC_SUCCESS, #5] 
10:51:21.064 detox[29652] DEBUG: [EXEC_CMD, #6] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "settings put global window_animation_scale 0"
10:51:21.101 detox[29652] TRACE: [EXEC_SUCCESS, #6] 
10:51:21.101 detox[29652] DEBUG: [EXEC_CMD, #7] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "settings put global transition_animation_scale 0"
10:51:21.131 detox[29652] TRACE: [EXEC_SUCCESS, #7] 
10:51:21.132 detox[29652] DEBUG: [EXEC_CMD, #8] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "dumpsys power | grep \"^[ ]*m[UW].*=\""
10:51:21.170 detox[29652] TRACE: [EXEC_SUCCESS, #8]   mWakefulness=Awake
  mWakefulnessChanging=false
  mWakeLockSummary=0x1
  mUserActivitySummary=0x1
  mWakeUpWhenPluggedOrUnpluggedConfig=false
  mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig=false
  mUserActivityTimeoutOverrideFromWindowManager=-1
  mUserInactiveOverrideFromWindowManager=false
  mUserId=0

10:51:21.180 detox[29652] DEBUG: [EXEC_CMD, #9] "/Users/admin/Library/Android/sdk/build-tools/33.0.0-rc2/aapt" dump badging "/Users/admin/Projects/Work/mobile-wallet/android/app/build/outputs/apk/release/app-release.apk"
10:51:21.209 detox[29652] TRACE: [EXEC_SUCCESS, #9] package: name='com.velas.mobile_wallet' versionCode='228' versionName='2.2.8' platformBuildVersionName='12' platformBuildVersionCode='31' compileSdkVersion='31' compileSdkVersionCodename='12'
sdkVersion:'21'
targetSdkVersion:'30'
uses-permission: name='android.permission.CAMERA'
uses-permission: name='android.permission.INTERNET'
uses-permission: name='android.permission.READ_EXTERNAL_STORAGE'
uses-permission: name='android.permission.SYSTEM_ALERT_WINDOW'
uses-permission: name='android.permission.USE_BIOMETRIC'
uses-permission: name='android.permission.USE_FINGERPRINT'
uses-permission: name='android.permission.VIBRATE'
uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'
uses-permission: name='android.permission.ACCESS_NETWORK_STATE'
uses-permission: name='android.permission.ACCESS_WIFI_STATE'
uses-permission: name='com.google.android.c2dm.permission.RECEIVE'
uses-permission: name='com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE'
application-label:'Velas wallet'
application-label-af:'Velas wallet'
application-label-am:'Velas wallet'
application-label-ar:'Velas wallet'
application-label-as:'Velas wallet'
application-label-az:'Velas wallet'
application-label-be:'Velas wallet'
application-label-bg:'Velas wallet'
application-label-bn:'Velas wallet'
application-label-bs:'Velas wallet'
application-label-ca:'Velas wallet'
application-label-cs:'Velas wallet'
application-label-da:'Velas wallet'
application-label-de:'Velas wallet'
application-label-el:'Velas wallet'
application-label-en-AU:'Velas wallet'
application-label-en-CA:'Velas wallet'
application-label-en-GB:'Velas wallet'
application-label-en-IN:'Velas wallet'
application-label-en-XC:'Velas wallet'
application-label-es:'Velas wallet'
application-label-es-US:'Velas wallet'
application-label-et:'Velas wallet'
application-label-eu:'Velas wallet'
application-label-fa:'Velas wallet'
application-label-fi:'Velas wallet'
application-label-fr:'Velas wallet'
application-label-fr-CA:'Velas wallet'
application-label-gl:'Velas wallet'
application-label-gu:'Velas wallet'
application-label-hi:'Velas wallet'
application-label-hr:'Velas wallet'
application-label-hu:'Velas wallet'
application-label-hy:'Velas wallet'
application-label-in:'Velas wallet'
application-label-is:'Velas wallet'
application-label-it:'Velas wallet'
application-label-iw:'Velas wallet'
application-label-ja:'Velas wallet'
application-label-ka:'Velas wallet'
application-label-kk:'Velas wallet'
application-label-km:'Velas wallet'
application-label-kn:'Velas wallet'
application-label-ko:'Velas wallet'
application-label-ky:'Velas wallet'
application-label-lo:'Velas wallet'
application-label-lt:'Velas wallet'
application-label-lv:'Velas wallet'
application-label-mk:'Velas wallet'
application-label-ml:'Velas wallet'
application-label-mn:'Velas wallet'
application-label-mr:'Velas wallet'
application-label-ms:'Velas wallet'
application-label-my:'Velas wallet'
application-label-nb:'Velas wallet'
application-label-ne:'Velas wallet'
application-label-nl:'Velas wallet'
application-label-or:'Velas wallet'
application-label-pa:'Velas wallet'
application-label-pl:'Velas wallet'
application-label-pt:'Velas wallet'
application-label-pt-BR:'Velas wallet'
application-label-pt-PT:'Velas wallet'
application-label-ro:'Velas wallet'
application-label-ru:'Velas wallet'
application-label-si:'Velas wallet'
application-label-sk:'Velas wallet'
application-label-sl:'Velas wallet'
application-label-sq:'Velas wallet'
application-label-sr:'Velas wallet'
application-label-sr-Latn:'Velas wallet'
application-label-sv:'Velas wallet'
application-label-sw:'Velas wallet'
application-label-ta:'Velas wallet'
application-label-te:'Velas wallet'
application-label-th:'Velas wallet'
application-label-tl:'Velas wallet'
application-label-tr:'Velas wallet'
application-label-uk:'Velas wallet'
application-label-ur:'Velas wallet'
application-label-uz:'Velas wallet'
application-label-vi:'Velas wallet'
application-label-zh-CN:'Velas wallet'
application-label-zh-HK:'Velas wallet'
application-label-zh-TW:'Velas wallet'
application-label-zu:'Velas wallet'
application-icon-120:'res/mipmap-mdpi-v4/ic_launcher.png'
application-icon-160:'res/mipmap-mdpi-v4/ic_launcher.png'
application-icon-240:'res/mipmap-hdpi-v4/ic_launcher.png'
application-icon-320:'res/mipmap-xhdpi-v4/ic_launcher.png'
application-icon-480:'res/mipmap-xxhdpi-v4/ic_launcher.png'
application-icon-640:'res/mipmap-xxxhdpi-v4/ic_launcher.png'
application-icon-65534:'res/mipmap-mdpi-v4/ic_launcher.png'
application: label='Velas wallet' icon='res/mipmap-mdpi-v4/ic_launcher.png'
launchable-activity: name='com.velas.mobile_wallet.MainActivity'  label='Velas wallet' icon=''
feature-group: label=''
  uses-feature-not-required: name='android.hardware.camera'
  uses-feature-not-required: name='android.hardware.camera.autofocus'
  uses-feature: name='android.hardware.faketouch'
  uses-implied-feature: name='android.hardware.faketouch' reason='default feature for all apps'
  uses-feature: name='android.hardware.screen.portrait'
  uses-implied-feature: name='android.hardware.screen.portrait' reason='one or more activities have specified a portrait orientation'
  uses-feature: name='android.hardware.wifi'
  uses-implied-feature: name='android.hardware.wifi' reason='requested android.permission.ACCESS_WIFI_STATE permission'
main
other-activities
other-services
supports-screens: 'small' 'normal' 'large'
supports-any-density: 'true'
locales: '--_--' 'af' 'am' 'ar' 'as' 'az' 'be' 'bg' 'bn' 'bs' 'ca' 'cs' 'da' 'de' 'el' 'en-AU' 'en-CA' 'en-GB' 'en-IN' 'en-XC' 'es' 'es-US' 'et' 'eu' 'fa' 'fi' 'fr' 'fr-CA' 'gl' 'gu' 'hi' 'hr' 'hu' 'hy' 'in' 'is' 'it' 'iw' 'ja' 'ka' 'kk' 'km' 'kn' 'ko' 'ky' 'lo' 'lt' 'lv' 'mk' 'ml' 'mn' 'mr' 'ms' 'my' 'nb' 'ne' 'nl' 'or' 'pa' 'pl' 'pt' 'pt-BR' 'pt-PT' 'ro' 'ru' 'si' 'sk' 'sl' 'sq' 'sr' 'sr-Latn' 'sv' 'sw' 'ta' 'te' 'th' 'tl' 'tr' 'uk' 'ur' 'uz' 'vi' 'zh-CN' 'zh-HK' 'zh-TW' 'zu'
densities: '120' '160' '240' '320' '480' '640' '65534'
native-code: 'arm64-v8a' 'armeabi-v7a' 'x86' 'x86_64'

10:51:21.224 ROOT_DESCRIBE_BLOCK[29652] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onRunDescribeStart({ name: 'ROOT_DESCRIBE_BLOCK' })
10:51:21.225 Example[29652] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onRunDescribeStart({ name: 'Example' })
10:51:21.225 detox[29652] INFO:  Example is assigned to emulator-13840 (Pixel_XL_API_30_AOSP)
10:51:21.228 detox[29652] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onBeforeTerminateApp({ deviceId: 'emulator-13840', bundleId: 'com.velas.mobile_wallet' })
10:51:21.228 detox[29652] DEBUG: [EXEC_CMD, #10] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "am force-stop com.velas.mobile_wallet"
10:51:21.275 detox[29652] TRACE: [EXEC_SUCCESS, #10] 
10:51:21.275 detox[29652] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onTerminateApp({ deviceId: 'emulator-13840', bundleId: 'com.velas.mobile_wallet' })
10:51:21.276 detox[29652] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onBeforeLaunchApp({
  deviceId: 'emulator-13840',
  bundleId: 'com.velas.mobile_wallet',
  launchArgs: {
    detoxServer: 'ws://localhost:56944',
    detoxSessionId: '53f02e01-4052-92eb-eb3a-102c5dbcbf8b'
  }
})
10:51:21.276 detox[29652] DEBUG: [EXEC_CMD, #11] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "date +\"%m-%d %T.000\""
10:51:21.305 detox[29652] TRACE: [EXEC_SUCCESS, #11] 04-15 10:51:21.000

10:51:21.306 detox[29652] DEBUG: [EXEC_CMD, #12] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 reverse tcp:56944 tcp:56944
10:51:21.317 detox[29652] TRACE: [EXEC_SUCCESS, #12] 56944

10:51:21.318 detox[29652] DEBUG: [EXEC_CMD, #13] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "pm list instrumentation"
10:51:21.355 detox[29652] TRACE: [EXEC_SUCCESS, #13] 
10:51:21.357 detox[29652] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onHookFailure({
  error: DetoxRuntimeError: No instrumentation runner found on device emulator-13840 for package com.velas.mobile_wallet
      at _callee$ (/Users/admin/Projects/Work/mobile-wallet/e2e/tests/firstTest.test.ts:5:18)
      at tryCatch (/Users/admin/Projects/Work/mobile-wallet/node_modules/regenerator-runtime/runtime.js:63:40)
      at Generator.invoke [as _invoke] (/Users/admin/Projects/Work/mobile-wallet/node_modules/regenerator-runtime/runtime.js:294:22)
      at Generator.next (/Users/admin/Projects/Work/mobile-wallet/node_modules/regenerator-runtime/runtime.js:119:21)
      at tryCatch (/Users/admin/Projects/Work/mobile-wallet/node_modules/regenerator-runtime/runtime.js:63:40)
      at invoke (/Users/admin/Projects/Work/mobile-wallet/node_modules/regenerator-runtime/runtime.js:155:20)
      at /Users/admin/Projects/Work/mobile-wallet/node_modules/regenerator-runtime/runtime.js:190:11
      at new Promise (<anonymous>)
      at callInvokeWithMethodAndArg (/Users/admin/Projects/Work/mobile-wallet/node_modules/regenerator-runtime/runtime.js:189:16)
      at AsyncIterator.enqueue (/Users/admin/Projects/Work/mobile-wallet/node_modules/regenerator-runtime/runtime.js:212:13)
      at AsyncIterator.next (/Users/admin/Projects/Work/mobile-wallet/node_modules/regenerator-runtime/runtime.js:119:21)
      at Object.<anonymous>.exports.async (/Users/admin/Projects/Work/mobile-wallet/node_modules/regenerator-runtime/runtime.js:239:14)
      at _callee (/Users/admin/Projects/Work/mobile-wallet/e2e/tests/firstTest.test.ts:4:13)
      at Promise.then.completed (/Users/admin/Projects/Work/mobile-wallet/node_modules/jest-circus/build/utils.js:391:28),
  hook: 'beforeAll'
})
10:51:21.357 detox[29652] TRACE: [ARTIFACT_START] starting ADBScreencapRecording
10:51:21.357 detox[29652] DEBUG: [EXEC_CMD, #14] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "screencap /sdcard/105120861_0.png"
10:51:22.096 detox[29652] TRACE: [EXEC_SUCCESS, #14] 
10:51:22.096 detox[29652] TRACE: [ARTIFACT_STOP] stopping ADBScreencapRecording
10:51:22.097 detox[29652] INFO:  Example: should have welcome screen
10:51:22.098 detox[29652] INFO:  Example: should have welcome screen [FAIL]
10:51:22.099 Example[29652] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onRunDescribeFinish({ name: 'Example' })

10:51:22.099 ROOT_DESCRIBE_BLOCK[29652] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onRunDescribeFinish({ name: 'ROOT_DESCRIBE_BLOCK' })
10:51:22.111 detox[29652] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onBeforeCleanup()
10:51:22.111 detox[29652] TRACE: [ARTIFACT_START] starting ADBScreencapRecording
10:51:22.112 detox[29652] DEBUG: [EXEC_CMD, #15] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "screencap /sdcard/105120861_1.png"
10:51:22.828 detox[29652] TRACE: [EXEC_SUCCESS, #15] 
10:51:22.828 detox[29652] TRACE: [ARTIFACT_STOP] stopping ADBScreencapRecording
10:51:22.832 detox[29652] TRACE: [ARTIFACT_SAVE] saving ADBScreencapRecording to: artifacts/android.2022-04-15 07-51-19Z/beforeAllFailure.png
10:51:22.832 detox[29652] DEBUG: [EXEC_CMD, #16] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 pull "/sdcard/105120861_0.png" "artifacts/android.2022-04-15 07-51-19Z/beforeAllFailure.png"
10:51:22.864 detox[29652] TRACE: [EXEC_SUCCESS, #16] /sdcard/105120861_0.png: 1 file pulled, 0 skipped. 64.7 MB/s (180181 bytes in 0.003s)

10:51:22.864 detox[29652] DEBUG: [EXEC_CMD, #17] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "rm  \"/sdcard/105120861_0.png\""
10:51:22.899 detox[29652] TRACE: [EXEC_SUCCESS, #17] 
10:51:22.899 detox[29652] TRACE: [ARTIFACT_SAVE] saving ADBScreencapRecording to: artifacts/android.2022-04-15 07-51-19Z/appNotReady.png
10:51:22.900 detox[29652] DEBUG: [EXEC_CMD, #18] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 pull "/sdcard/105120861_1.png" "artifacts/android.2022-04-15 07-51-19Z/appNotReady.png"
10:51:22.917 detox[29652] TRACE: [EXEC_SUCCESS, #18] /sdcard/105120861_1.png: 1 file pulled, 0 skipped. 75.0 MB/s (180181 bytes in 0.002s)

10:51:22.917 detox[29652] DEBUG: [EXEC_CMD, #19] "/Users/admin/Library/Android/sdk/platform-tools/adb" -s emulator-13840 shell "rm  \"/sdcard/105120861_1.png\""
10:51:22.951 detox[29652] TRACE: [EXEC_SUCCESS, #19] 
10:51:22.954 detox[29652] TRACE: [SESSION_TORN] tester exited session 53f02e01-4052-92eb-eb3a-102c5dbcbf8b
10:51:22.955 detox[29652] DEBUG: [WSS_CLOSE] Detox server has been closed gracefully
 FAIL  e2e/tests/firstTest.test.ts
  Example
    ✕ should have welcome screen (1 ms)

  ● Example › should have welcome screen

    DetoxRuntimeError: No instrumentation runner found on device emulator-13840 for package com.velas.mobile_wallet

      3 | describe('Example', () => {
      4 |   beforeAll(async () => {
    > 5 |     await device.launchApp();
        |                  ^
      6 |   });
      7 |
      8 |   beforeEach(async () => {

      at _callee$ (tests/firstTest.test.ts:5:18)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:63:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:294:22)
      at Generator.next (../node_modules/regenerator-runtime/runtime.js:119:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:63:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:155:20)
      at ../node_modules/regenerator-runtime/runtime.js:190:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:189:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:212:13)
      at AsyncIterator.next (../node_modules/regenerator-runtime/runtime.js:119:21)
      at Object.<anonymous>.exports.async (../node_modules/regenerator-runtime/runtime.js:239:14)
      at _callee (tests/firstTest.test.ts:4:13)

10:51:22.978 detox[29651] ERROR: [cli.js] Command failed: jest --config e2e/jest-runner-config.js --testNamePattern '^((?!:ios:).)*$' e2e
laisvitoria commented 1 year ago

@FrozenPyrozen I have same error. Any solution?

jahglow commented 1 year ago

me too

jailsonpaca commented 1 year ago

up

zareanmasoud commented 1 year ago

I fixed it this way: https://stackoverflow.com/a/72171304/9470990

bthiruven commented 11 months ago

I'm also getting the same error "No instrumentation runner found on device emulator-5554" and I'm having the following config RN - 0.72.1. Gradle: 8.0.1

And It works well for ios, but not for android. Is that coz of the gradle version not being compatible.

I saw the official doc and the support is still upto 0.71.x.

One the things i would like to know is where to place the file DetoxTest.java. Should it be under

src/androidTest/java/com/<packageName>

or

src/androidTest/

I tried both. And on both the cases, i get the same error. Also have tried having testBinaryPath in .detoxrc.js file as well. I tried to clean the build and tried again.

If anyone has any solution, Please advise

bthiruven commented 11 months ago

Found the solution. just thought of sharing if someone else is looking for a solution for the problem i mentioned above The file DetoxTest.java should be under the following mentioned folder which is what that has mentioned in the documentation.

  1. src/androidTest/java/com/
  2. testBinaryPath need to be provided which should point the androidTest binary apk
  3. binaryPath is also required to point out the your app apk.

Besides the other problem I was facing was i'm using fastlane for my build which uses different variations of the build (for eg., build variant being Qa, then api should pointing to qa etc). To cater to these i've build a separate lane and have executed a command like the one below for eg.,

./gradlew  assembleDebug assembleAndroidTest -DtestBuildType=debug
-PMYAPP_API_VARIANT=prod -PMYAPP_APP_VARIANT=myAppName -PMYAPP_BUILD_VARIANT=prod -PmainActivity=MainActivity  -Pvariant=mymobileappdebug  -PappId=com.xxx.xxx.xxx.prod
juls-k commented 10 months ago

I had the same problem as well. In my case, all the paths were correct. Here's how I solved it:

  1. Run the following to check if the package you installed is properly installed. adb -s emulator-5554 shell pm list packages

  2. Manually install the androidTest.apk. adb -s emulator-5554 install android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk

  3. Run the tests. yarn detox test --configuration android.emu.debug