I was glad to hear that Android studio made some updates to make unit testing simple in Android studio, so I tried to configure roboelectric, but I can not get past this error that occurs during the following method.
MainActivity = Robolectric.buildActivity(MainActivity.class).create().get();
with the following stacktrace
Throws: 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
Why is this happening and what can I do to get past him?
source
share