【问题标题】:Detox successfully builds but does not install app on Android emulatorDetox 成功构建但未在 Android 模拟器上安装应用程序
【发布时间】:2020-12-04 10:30:07
【问题描述】:

我得到了一个成功的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"
      }
    },

【问题讨论】:

    标签: react-native detox


    【解决方案1】:

    这与 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",
    

    【讨论】:

      猜你喜欢
      • 2022-11-17
      • 2011-07-01
      • 1970-01-01
      • 2015-02-12
      • 2018-12-08
      • 1970-01-01
      • 2011-06-04
      • 2020-08-01
      相关资源
      最近更新 更多