Coder Social home page Coder Social logo

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
I think there's a problem in this code, because this is where the exception was 
thrown
RootViewPicker

  private void waitForAtLeastOneActivityToBeResumed() {
    Collection<Activity> resumedActivities =
        activityLifecycleMonitor.getActivitiesInStage(Stage.RESUMED);
    if (resumedActivities.isEmpty()) {
      uiController.loopMainThreadUntilIdle();
      resumedActivities = activityLifecycleMonitor.getActivitiesInStage(Stage.RESUMED);
    }
    if (resumedActivities.isEmpty()) {
      List<Activity> activities = Lists.newArrayList();
      for (Stage s : EnumSet.range(Stage.PRE_ON_CREATE, Stage.RESTARTED)) {
        activities.addAll(activityLifecycleMonitor.getActivitiesInStage(Stage.RESUMED));
      }
      if (activities.isEmpty()) {
        throw new RuntimeException("No activities found. Did you forget to launch the activity "
            + "by calling getActivity() or startActivitySync or similar?");
      }

When there's no activity in resumed state, it tries to find all activities in 
other states. However, when calling to the activitymonitor, it still passes 
Stage.RESUME in. It should be:
      for (Stage s : EnumSet.range(Stage.PRE_ON_CREATE, Stage.RESTARTED)) {
        activities.addAll(activityLifecycleMonitor.getActivitiesInStage(s));
      }

Original comment by [email protected] on 19 Dec 2013 at 6:22

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
There's another problem in the method:

      for (int waitIdx = 0; waitIdx < waitTimes.length; waitIdx++) {
        Log.w(TAG, "No activity currently resumed - waiting: " + waitTimes[waitIdx]
            + "ms for one to appear.");
        uiController.loopMainThreadForAtLeast(waitTimes[waitIdx]);
        resumedActivities = activityLifecycleMonitor.getActivitiesInStage(Stage.RESUMED);
        if (!resumedActivities.isEmpty()) {
          break;
        }
      }
      throw new RuntimeException("No activities in stage RESUMED. Did you forget to launch the "
          + "activity. (test.getActivity() or similar)?");

Even if it gets the resumed activities in the for loop, it will still throw the 
exception. It should be 

if(resumedActivities.isEmpty())
{
      throw new RuntimeException("No activities in stage RESUMED. Did you forget to launch the "
          + "activity. (test.getActivity() or similar)?");
}

Original comment by [email protected] on 29 Dec 2013 at 11:32

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Thanks for reporting. Will be fixed in the next release.

Original comment by [email protected] on 2 Jan 2014 at 9:22

  • Changed state: Accepted

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Fixed in 1.1

Original comment by [email protected] on 9 Jan 2014 at 7:34

  • Changed state: Fixed

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Using 1.1 but still having this issue

Original comment by [email protected] on 9 Mar 2014 at 4:01

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Same here, this is still a problem

Original comment by [email protected] on 8 Jan 2015 at 7:47

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
I confirm that the issue still occurs on Espresso 2.0. Marking this as FIXED 
seems premature to me.

Original comment by [email protected] on 31 Jan 2015 at 10:53

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
getActivity() cause app crash.

it mention about attempt to invoke virtual method.

Original comment by [email protected] on 18 Feb 2015 at 2:56

from android-test-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Still having this issue. Is there a workaround ?


java.lang.RuntimeException: No activities found. Did you forget to launch the 
activity by calling getActivity() or startActivitySync or similar?
at 
android.support.test.espresso.base.RootViewPicker.waitForAtLeastOneActivityToBeR
esumed(RootViewPicker.java:189)
at 
android.support.test.espresso.base.RootViewPicker.findRoot(RootViewPicker.java:1
34)
at android.support.test.espresso.base.RootViewPicker.get(RootViewPicker.java:80)
at 
android.support.test.espresso.ViewInteractionModule.provideRootView(ViewInteract
ionModule.java:69)
at 
android.support.test.espresso.ViewInteractionModule_ProvideRootViewFactory.get(V
iewInteractionModule_ProvideRootViewFactory.java:23)
at 
android.support.test.espresso.ViewInteractionModule_ProvideRootViewFactory.get(V
iewInteractionModule_ProvideRootViewFactory.java:9)
at 
android.support.test.espresso.base.ViewFinderImpl.getView(ViewFinderImpl.java:68
)
at android.support.test.espresso.ViewInteraction$2.run(ViewInteraction.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)



Original comment by [email protected] on 16 Jul 2015 at 4:44

from android-test-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.