DetoxRuntimeError: Failed to run application on the device -Android

DetoxRuntimeError: Failed to run application on the device -Android

运行 在 Pixel_3_API_29 Android 10.0 x86

我用其他 react-native 代码测试了这个模拟器,发现 Detox 工作正常。

我不确定我的依赖项是否导致了问题?

$ detox test -c android.emu.debug                        detox[8179] INFO:  [test.js] configuration="android.emu.debug" reportSpecs=true readOnlyEmu=false useCustomLogger=true DETOX_START_TIMESTAMP=1586124976279 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:ios:).)*$' --maxWorkers 1 "e2e"

detox[8187] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR] 
 DetoxRuntimeError: Failed to run application on the device

HINT: Most likely, your main activity has crashed prematurely

Native stacktrace dump: 
    at EmulatorDriver._getInstrumentationCrashError (/media/kok/Data/react-native/StellarUI/node_modules/detox/src/devices/drivers/AndroidDriver.js:175:12)
    at EmulatorDriver.instrumentationCloseListener (/media/kok/Data/react-native/StellarUI/node_modules/detox/src/devices/drivers/AndroidDriver.js:142:67)
    at EmulatorDriver._terminateInstrumentation (/media/kok/Data/react-native/StellarUI/node_modules/detox/src/devices/drivers/AndroidDriver.js:166:12)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at ChildProcess.<anonymous> (/media/kok/Data/react-native/StellarUI/node_modules/detox/src/devices/drivers/AndroidDriver.js:260:7) {
  name: 'DetoxRuntimeError'
}
detox[8187] WARN:  [Client.js/PENDING_REQUESTS] App has not responded to the network requests below:
  (id = -1000) isReady: {}

Unresponded network requests might result in timeout errors in Detox tests.
...

其他配置

"jest": {
    "preset": "react-native"
  },
  "detox": {
    "configurations": {
      "android.emu.debug": {
        "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
        "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
        "type": "android.emulator",
        "name": "Pixel_3_API_29"
      },
      "android.emu.release": {
        "binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
        "build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
        "type": "android.emulator",
        "name": "Pixel_3_API_29"
      }
    },
    "test-runner": "jest"
  },

状态:

react-native start ok

react-native run-android ok

detox build ok

detox test debug fail!

我 运行 遇到了同样的错误,这是因为我使用的排毒版本不支持 Android 和 react-native 0.62。您需要将 detox 升级到 16.2.0。

参见:https://github.com/wix/Detox/releases/tag/16.2.0