My Android project has about ~70 Robolectric tests and they were all passing for 2 months. Somehow, starting today, the tests are failing with weird error messages:
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
- java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient
- Also can't load resource files
I didn't change my code, so it can't be code related issue. I cleaned project and gradle but it didn't help. I did do a update promoted by Android Studio a few days ago, not sure if related.
Is anyone else is experiencing the issue? How do I get out of this bad state?
-- edit --
Robolectric version matters! Interesting observation based on suggestions in comments, robolectric version v.s. failure rate:
- 3.3.1, ~40% of the tests fail.
- 3.2.2, ~40% failure (same as 3.3.1)
- 3.1.4, ~15% failure
- 3.1.2, ~0% failure (with caveats, see below)
- 3.1, 100% failure (!)
Another observation is that it's inconsistent. If I run the whole set, all pass! But If I only run one test file, all fail with this message:
No such manifest file: build/intermediates/bundles/debug/AndroidManifest.xml