【发布时间】:2023-04-03 00:52:02
【问题描述】:
我有 2 个模块,模块 A 和模块 B。模块 B 依赖于模块 A,模块 A 通过使用 api 配置与模块 B 共享依赖库。
在设置测试环境时,在模块 A 内部,我还使用 testApi 和 androidTestApi 使模块 B 使用共享测试库。但是,在运行 gradle sync 后,我收到了警告消息:WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'。
阅读提供的link,它说other modules can't depend on androidTest, you get the following warning if you use the androidTestApi configuration。因此,在我的示例中,我必须在模块 B 中定义测试库以跳过此警告。
我对这种情况有一些疑问:
- 为什么一个模块不应该依赖于其他模块的测试依赖项,尽管它可以依赖于定义为
api的正常依赖项? - 我们是否必须强制模块 B 依赖于模块 A 的测试库而不在模块 B 中再次定义这些库?
非常感谢
【问题讨论】:
-
嘿!您找到以下问题的任何解决方案了吗?我知道某些模块不能依赖于 androidTestApi ,这很好。但是我找不到 testApi 也过时的充分理由。
-
我到现在也没有找到任何解决方案:(
标签: android testing android-gradle-plugin