我正在尝试运行
Robolectric sample
RobolectricDemoProject
使用 IDEA 进行项目,我得到了错误
Class not found: "de.peterfriese.robolectricdemo.MainActivityTest" Process finished with exit code 1
但是当我使用 gradle test 命令时一切正常。
this is my Junit config
最佳答案
现在,在 IDEA 中,您使用的是非 gradle 项目。这意味着您可以查看项目结构 (Ctrl+Shift+Alt+S) 并查看库可见性。 (运行时,提供等)也存在导出属性。当提供库或未导出库时,目标 apk 中将不存在。
您也可以将项目构建为 gradle 测试项目。所以 IDEA 将使用你的 gradle 测试目标。构建将花费更多时间。
关于android - 从 IDEA 运行 Robolectric 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21703641/