1

我想在现有的 Android Studio 1.1 项目上添加对单元测试的支持。我按照教程进行操作,但出现错误:

   java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NoSuchMethodException: android.os.Looper.<init>(boolean)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:228)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at ... 

我找到了这个解决方案,但只适用于mac,我在windows中找不到类似的方法。

4

1 回答 1

0

我刚发现。在我的 maven settings.xml 中,我添加了(在maven site中指定):

<localRepository>${user.home}/.m2/repository</localRepository>

删除它后,Roboletric 工作正常。

于 2015-04-15T17:47:20.317 回答