Gradle Robolectric Resources NotFoundException in Testing

前端 未结 2 489
深忆病人
深忆病人 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:06

    At the end I managed to solve it moving to Robolectric v2.3-SNAPSHOT.

    You can find this SNAPSHOT here oss.sonatype.org/index.html#nexus-search;quick~org.robolectric

    The same Jake Wharton plugin works well with this Robolectric v2.3-SNAPSHOT.

    Perhaps this information might help someone else.

    0 讨论(0)
  • 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 {
    ...
    }
    
    0 讨论(0)
提交回复
热议问题