排毒成功构建但未在Android模拟器上安装应用

问题描述

我成功获得detox build的支持,模拟器已启动,但从未安装过该应用程序。

react-native run-android(无排毒)效果很好。

我看到的唯一错误(包括详细模式下)是:“未找到工具运行器”,但我猜测这只是意味着Detox找不到该应用程序(从未安装)。

如何获取Detox将应用程序实际安装到模拟器上?我看到的唯一线索是,在这种情况下,程序包名称后面附加了.test,但这可能是一个问题,但我对此不确定。

(我尝试adb install测试应用程序,但不能解决问题,运行命令adb -e install android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk时模拟器中也没有任何显示。此安装命令适用于我们的标准调试APK。)

日志:

BUILD SUCCESSFUL in 25s
1029 actionable tasks: 1 executed,1028 up-to-date
detox[66003] INFO:  [test.js] configuration="android.emu.debug" reportSpecs=true readOnlyEmu=false useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1597412615185 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:ios:).)*$' --maxWorkers 1 e2e
detox[66004] INFO:  [DetoxServer.js] server listening on localhost:55217...
detox[66004] ERROR: Error: No instrumentation runner found on device emulator-11448 for package com.myco.myapp.test
detox[66004] INFO:  Example is assigned to undefined
detox[66004] INFO:  Example: should have welcome screen
detox[66004] INFO:  Example: should have welcome screen [SKIPPED]

detox[66003] ERROR: [cli.js] Error: Command failed: node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:ios:).)*$' --maxWorkers 1 e2e

detoxrc条目:

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

解决方法

这与APK路径有关。 Detox尝试计算调试APK路径,如果有误,它将出现这些错误。 (如果为不同的体系结构构建多个版本的APK,则Detox似乎无法处理该问题。)

解决方案是指向您的两个APK-调试应用(“二进制”)和检测APK(“测试二进制”):

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...