"java.lang.RuntimeException: Failed to start intent" for user interface with undefined ProgressBar

Are there any known issues with displaying an undefined ProgressBar with AndroidJUnitRunner? I hit this error during tests:

05-26 15: 22: 48.504 1003-1016 /? I / TestRunner: java.lang.RuntimeException: Failed to start Intent intent {act = android.intent.action.MAIN flg = 0x14000000 cmp = com.cookbrite.dev/com.cookbrite.ui.HomeListActivity} for 45 seconds. Perhaps the main thread was not idle in a reasonable amount of time? Maybe an animation or something constantly repainting the screen. Or does activity make network calls create? See threaddump logs. For reference, the last time the event queue was idle before your activity start request was 1432668122421 and now the last time the queue was idle was: 1432668122421. If these numbers match, your activity may depend on the event queue.

Stack trace:

 05-26 15:22:48.504 1003-1016/? I/TestRunner﹕ java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.cookbrite.dev/com.cookbrite.ui.HomeListActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1432668122421 and now the last time the queue went idle was: 1432668122421. If these numbers are the same your activity might be hogging the event queue.      at android.support.test.runner.MonitoringInstrumentation.startActivitySync(MonitoringInstrumentation.java:274)      at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:119)      at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:97)      at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:104)      at com.cookbrite.step2_functional.ui.homelist.HomeListFragmentLoadingTest.testLoadingSpinner(HomeListFragmentLoadingTest.java:40)      at java.lang.reflect.Method.invokeNative(Native Method)      at java.lang.reflect.Method.invoke(Method.java:525)      at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)      at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)      at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)      at com.cookbrite.util.BaseBlackBoxTest.doRunTest(BaseBlackBoxTest.java:300)      at com.cookbrite.util.BaseBlackBoxTest.access$000(BaseBlackBoxTest.java:44)      at com.cookbrite.util.BaseBlackBoxTest$1.call(BaseBlackBoxTest.java:271)      at java.util.concurrent.FutureTask.run(FutureTask.java:234)      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)      at java.lang.Thread.run(Thread.java:841) 

A thread dump caused by the above timeout indicates that a ProgressBar involved:

 05-26 15:22:48.135 1003-1018/? E/THREAD_STATE﹕ Thread[main,5,main] android.graphics.Canvas.native_drawBitmap(Native Method) android.graphics.Canvas.drawBitmap(Canvas.java:1160) android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:440) android.graphics.drawable.RotateDrawable.draw(RotateDrawable.java:88) android.graphics.drawable.LayerDrawable.draw(LayerDrawable.java:345) android.widget.ProgressBar.onDraw(ProgressBar.java:1052) android.view.View.draw(View.java:13944) android.view.View.draw(View.java:13825) android.view.ViewGroup.drawChild(ViewGroup.java:3086) android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923) android.view.View.draw(View.java:13823) android.view.ViewGroup.drawChild(ViewGroup.java:3086) android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923) android.view.View.draw(View.java:13947) android.view.View.draw(View.java:13825) android.view.ViewGroup.drawChild(ViewGroup.java:3086) android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923) android.view.View.draw(View.java:13823) android.view.ViewGroup.drawChild(ViewGroup.java:3086) android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923) android.view.View.draw(View.java:13947) android.widget.FrameLayout.draw(FrameLayout.java:467) android.view.View.draw(View.java:13825) android.view.ViewGroup.drawChild(ViewGroup.java:3086) android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923) android.view.View.draw(View.java:13823) android.view.ViewGroup.drawChild(ViewGroup.java:3086) android.view.ViewGroup.dispatchDraw(ViewGroup.java:2923) android.view.View.draw(View.java:13947) android.widget.FrameLayout.draw(FrameLayout.java:467) com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2224) android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2482) android.view.ViewRootImpl.draw(ViewRootImpl.java:2395) android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2239) android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1872) android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004) android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481) android.view.Choreographer$CallbackRecord.run(Choreographer.java:749) android.view.Choreographer.doCallbacks(Choreographer.java:562) android.view.Choreographer.doFrame(Choreographer.java:532) android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735) android.os.Handler.handleCallback(Handler.java:730) android.os.Handler.dispatchMessage(Handler.java:92) android.os.Looper.loop(Looper.java:137) android.app.ActivityThread.main(ActivityThread.java:5103) java.lang.reflect.Method.invokeNative(Native Method) java.lang.reflect.Method.invoke(Method.java:525) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) dalvik.system.NativeStart.main(Native Method) Thread[Binder_2,5,main] dalvik.system.NativeStart.run(Native Method) Thread[JDWP,5,system] dalvik.system.NativeStart.run(Native Method) Thread[pool-1-thread-1,5,main] java.lang.Object.wait(Native Method) java.lang.Object.wait(Object.java:364) android.app.Instrumentation.startActivitySync(Instrumentation.java:403) android.support.test.runner.MonitoringInstrumentation.access$101(MonitoringInstrumentation.java:69) android.support.test.runner.MonitoringInstrumentation$3.call(MonitoringInstrumentation.java:265) android.support.test.runner.MonitoringInstrumentation$3.call(MonitoringInstrumentation.java:262) java.util.concurrent.FutureTask.run(FutureTask.java:234) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) java.lang.Thread.run(Thread.java:841) Thread[pool-5-thread-1,5,main] dalvik.system.VMStack.getThreadStackTrace(Native Method) java.lang.Thread.getStackTrace 
+4
android android-intent android-progressbar android-espresso android-instrumentation
May 26 '15 at
source share
1 answer

I don’t think you can really check the progress bars to make sure they finish.

We used progress indicators as well as a way of showing how much we were on time (for example, the 7th day of a 30-day cycle, so our progress indicator never ended). To avoid this problem, we had to use a different API level for our application. We only seemed to have this problem with an emulator with an API level of 21. After we switched our emulator to API level 19, our tests passed successfully.

Note. We also had some success with modifying the progressBar with simple test views, but we decided that it was more hacked than we liked.

+1
Jul 21 '15 at 20:39
source share
— -



All Articles