javaandroidwindowsandroid-studiorobolectric-gradle-plugin

Can't run Roboletric on windows: java.lang.NoSuchMethodException: android.os.Looper.<init>(boolean)


I want to add support for unit tests on an existing Android Studio 1.1 project. I followed this tutorial but I am getting the error:

   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 ... 

I found this solution but that only applies to mac, and I can't find a similar way to do it in windows.


Solution

  • I just found out. In my maven settings.xml I added (as specified in maven site):

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

    After remove it, Roboletric worked fine.