ProgressBar
AndroidJUnitRunner で不確定な s を表示することに関する既知の問題はありますか? テスト中にこのエラーが発生しました:
05-26 15:22:48.504 1003-1016/? I/TestRunner﹕ java.lang.RuntimeException: インテント { act=android.intent.action.MAIN flg=0x14000000 cmp=com.cookbrite.dev/com.cookbrite.ui.HomeListActivity } を 45 秒以内に起動できませんでした。妥当な時間内にメイン スレッドがアイドル状態になっていない可能性がありますか? アニメーションや、常に画面を再描画する何かが存在する可能性があります。または、アクティビティは作成時にネットワーク呼び出しを行っていますか? スレッドダンプ ログを参照してください。参考までに、アクティビティの起動リクエストが 1432668122421 である前にイベント キューが最後にアイドル状態だったとき、キューが最後にアイドル状態になったのは 1432668122421 でした。これらの数値が同じ場合、アクティビティがイベント キューを占有している可能性があります。
スタック トレースは次のとおりです。
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)
上記のタイムアウトによってトリガーされたスレッド ダンプは、ProgressBar
関連しているように見えることを示しています。
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