dimanche 26 avril 2015

Robolectric 3.0 java.lang.NoSuchMethodException on create activity

I was excited to hear that android studio had made some updates to make unit testing simple to do in android studio so I have been trying to set up roboelectric but I cant get past this error that occurs during the following method.

        MainActivity = Robolectric.buildActivity(MainActivity.class).create().get();

with the following stacktrace

Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: java.lang.Object.attach(android.content.Context, android.app.ActivityThread, android.app.Instrumentation, android.os.IBinder, int, android.app.Application, android.content.Intent, android.content.pm.ActivityInfo, java.lang.CharSequence, android.app.Activity, java.lang.String, android.app.Activity$NonConfigurationInstances, android.content.res.Configuration)
at org.robolectric.util.ReflectionHelpers.traverseClassHierarchy(ReflectionHelpers.java:248)
at org.robolectric.util.ReflectionHelpers.callInstanceMethod(ReflectionHelpers.java:138)
... 36 more

can anyone help me understand why this is occurring and what I can do to get past it?

Aucun commentaire:

Enregistrer un commentaire