我想在现有 Android Studio 1.1 项目上添加对单元测试的支持。我关注了this教程,但我收到错误:
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 ...
我找到了this解决方案,但这仅适用于 mac,我找不到在 windows 中执行此操作的类似方法。
最佳答案
我刚刚发现。在我的 Maven settings.xml 中,我添加了(如 maven site 中指定):
<localRepository>${user.home}/.m2/repository</localRepository>
删除后,Roboletric 工作正常。
关于java - 无法在 Windows 上运行 Roboletric : java. lang.NoSuchMethodException : android. os.Looper.<init>(boolean),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29635438/