因此,从Android P 开始,可以模拟UI / Espresso测试的最终类。很好。
经过研究,我使用com.linkedin.dexmaker:dexmaker-mockito-inline-extended
来模拟最终课程。
但是,它使用的是旧版本的Mockito(在撰写本文时为2.28.0
),而Mockito最近发布了版本为3.15.13
。
到目前为止,我一直使用Mockito的旧版本,直到我偶然发现了更高版本中解决的问题为止。
以下gradle配置:
androidTestImplementation "com.linkedin.dexmaker:dexmaker-mockito-inline-extended:2.28.0"
androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
androidTestImplementation "org.mockito:mockito-android:3.5.13"
在编译时产生此错误:
发现有多个文件与操作系统无关,路径为'mockito-extensions / org.mockito.plugins.MockMaker'。
我相信我知道这意味着某些依赖项使用相同的依赖项。我尝试使用排除但没有成功。
有人知道如何解决该问题吗?感谢您的帮助!
答案 0 :(得分:1)
删除androidTestImplementation "org.mockito:mockito-android:3.5.13"
对我有用。他们在他们的github https://github.com/linkedin/dexmaker/issues/149