Gradle Robolectric Resources NotFoundException in Testing

前端 未结 2 523
深忆病人
深忆病人 2021-01-12 05:58

I\'ve already knew that this issue has been asked before but I can\'t solve this problem. I am able to compile and apply test with jUnit, Robolectric and Gradle. The issue

2条回答
  •  忘掉有多难
    2021-01-12 06:16

    I had this same problem even with Robolectric v2.3-SNAPSHOT. Solved it by explicitly setting the manifest in the test file via the Config annotation, like

    @Config(manifest = "src/main/AndroidManifest.xml")
    @RunWith(RobolectricTestRunner.class)
    public class MainActivityTest extends AndroidTestCase {
    ...
    }
    

提交回复
热议问题