【问题标题】:Unresolved symbols for androidTest dependencies in case of non-standard build types在非标准构建类型的情况下,androidTest 依赖项的未解析符号
【发布时间】:2019-12-25 13:39:20
【问题描述】:

当我决定添加仪器测试时,我发现 androidTestImplementation 依赖项无法识别。在我的测试文件中,RunWith 等相关类显示为Unresolved symbols。 当我尝试运行测试时,在运行配置中有一条消息:Error: Instrumentation runner class not specified."。我已经检查过,在 build.gradle 中明确指定了检测运行器类。

我使用自定义构建类型,例如 debugDev、debugProd。

【问题讨论】:

    标签: android android-studio testing android-instrumentation


    【解决方案1】:

    事实证明,如果使用非标准构建类型,则需要选择构建配置来运行检测测试。可以通过在模块的 build.gradle 中使用 android {...} 中的 testBuildType "nameOfBuildType" 来完成。

    【讨论】:

      猜你喜欢
      • 2015-02-07
      • 1970-01-01
      • 2017-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-16
      相关资源
      最近更新 更多