Robolectric 3.0 java.lang.NoSuchMethodException on create activity

此生再无相见时 提交于 2019-12-22 08:11:44

问题


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

Why this is occurring and what I can do to get past it?

来源:https://stackoverflow.com/questions/29884419/robolectric-3-0-java-lang-nosuchmethodexception-on-create-activity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!