ClassCastException: NoClassDefFoundError cannot be cast to RuntimeException

独自空忆成欢 提交于 2019-12-03 05:52:04

This was confirmed as an issue with Robolectric 2.4 (Issue #1385). The issue has been closed by Erich Douglass today, with the following comment:

We are working on appcompat support for 3.0. Until then, there's not much you can do.

https://github.com/robolectric/robolectric/issues/1385

So until 3.0 is released, I will be using the following workaround:

./gradlew clean
./gradlew assemble
./gradlew test

Once the assemble has run, it has created all the items that Robolectric apparently needs. Then you can run your tests successfully. This solution is better than just running ./gradlew build or ./gradlew test twice, because it can be implemented both locally as well as on a CI tool like Travis or Jenkins. The syntax for running multiple Gradle tasks in Jenkins is leaving a single space between each task:

assemble test

After upgrading Android Gradle Plugin to 1.1.3 from 1.1.0 the exception went away. Can anyobody else confirm this? I'm using the setup described here: http://nenick-android.blogspot.de/2015/02/android-studio-110-beta-4-and.html

My issue is resolved. I updated my robolectirc to 2.4 and min SDK to 19 and android support to com.android.support:support-v13:19.1.0. And also did changes to iml files for the same.

Thanks For Your guidance and response

Venkatraman

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!