react-native - DetoxRuntimeError:无法在设备上运行应用程序 -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 启动正常
react-native run-android ok
排毒构建确定
排毒测试调试失败!
解决方案
我遇到了同样的错误,这是因为我使用的 detox 版本还不支持带有 react-native 0.62 的 Android。您需要将 detox 升级到 16.2.0。
推荐阅读
- html - 通过旋转创建水平滚动
- android - Gson 有没有办法检索子 JSON 对象信息而无需为它们创建自定义类?
- python - 等待条件变量超时:未及时重新获取锁
- firebase - 如何在 Firestore 的子集合中写入对象
- vue.js - Vue-cli 3组件库支持SSR
- pine-script - 我想在 pine 脚本中打印“i”的值
- discord - Discord PY 获取服务器的所有成员
- python-3.x - 每当我尝试导入 cntk 时,它都会显示 No module named 'cntk._cntk_py'
- api - 空手道模拟测试双打无法识别 headerContains 场景参数
- typescript - 类型以表示具有特定类型键的父级