【问题标题】:DetoxRuntimeError: Failed to run application on the device -AndroidDetoxRuntimeError:无法在设备上运行应用程序 -Android
【发布时间】:2020-07-17 21:32:15
【问题描述】:

在 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

排毒构建正常

排毒测试调试失败!

【问题讨论】:

    标签: react-native jestjs react-native-android detox


    【解决方案1】:

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

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

    【讨论】:

    • 这个答案有效吗?
    • 不知何故我得到了这个错误。在我的其他东西已经在工作的情况下启动并运行东西很复杂
    • 您好 Yash,我也遇到了同样的问题,您找到解决方案了吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-28
    • 2015-05-23
    • 1970-01-01
    • 2019-11-20
    • 2018-01-08
    相关资源
    最近更新 更多