2016-07-21 11 views
3

エスプレッソテストを実行しているとき、Jenkinsと特定のチームメイトのコンピュータで以下のエラーが発生しています。私はこのエラーを検索し、多くのことがタイムアウトかアニメーションのどちらかと関係しているのを見ています。すべてのデバイスにはアニメーションがオフになっています。Android/Espressoテストの実行中のインテントエラー

たとえば、先週この問題が発生していましたが、Android Studioをすべてアンインストールしてコードを削除してから、すべて再インストールしました。うまく行かなかった。私はJavaとJDKもアップグレードしました。その後、私はまだこの問題を抱えていた。その後、ある日、それはちょうど働いた。なぜ私は考えていない。

今、私の同僚がこの問題を抱えています。 1つのデバイス(5.1)に対して実行され、別のデバイス(5.1)に対して実行された場合、この問題が発生します。別の同僚が反対の問題を抱えています。

私の質問は何ですか?私は何を確認できますか?取るべきステップは何でしょうか?デバイス上のメモを比較しました。すべてのIDEはバージョン番号と一致し、ツールなどをビルドします。私はアイデアが不足しています。

ありがとうございます!

java.lang.RuntimeException: Could not launch intent Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.COMPANY.espresso/com.COMPANY.activity.LauncherActivity } 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 1469050322683 and now the last time the queue went idle was: 1469050322683. If these numbers are the same your activity might be hogging the event queue. 
at android.support.test.runner.MonitoringInstrumentation.startActivitySync(MonitoringInstrumentation.java:360) 
at android.support.test.rule.ActivityTestRule.launchActivity(ActivityTestRule.java:219) 
at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:268) 
at org.junit.rules.RunRules.evaluate(RunRules.java:20) 
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) 
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) 
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) 
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
at org.junit.runners.Suite.runChild(Suite.java:128) 
at org.junit.runners.Suite.runChild(Suite.java:27) 
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
at org.junit.runner.JUnitCore.run(JUnitCore.java:137) 
at org.junit.runner.JUnitCore.run(JUnitCore.java:115) 
at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59) 
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262) 
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1862) 
+0

あなたのアプリは起動時に何をしますか?バックグラウンドでコードを実行しますか?あなたの 'Application.onCreate()'では何が起こり、 'LauncherActivity'の' onCreate'、 'onStart'と' onResume'が実行されますか?あなたは不確定な 'ProgressBar'を表示しますか?あなたの 'Application'の' LauncherActivity'とそのレイアウトと 'onCreate'のコードを投稿してください。 – thaussma

+0

私はコードを表示することはできませんが、私たちのアプリはバックグラウンドネットワーク要求、認証を行い、シングルトンをいくつか設定しました。ローディングインジケータも表示されます。 – Skycamefalling

+0

画面のロックを解除するセキュリティがデバイスにないことを確認してください。テストが実行される前に、画面のロックが解除されていることを確認してください。 – gorbysbm

答えて

1

私の最初の推測では、ProgressBarブロックエスプレッソこととあなたのActivityのコンテンツビューが不確定ProgressBarが含まれていること、それは常に表示されているかonResume戻る前に見えるようになります。アニメーションはアプリケーションのビジー状態を維持し、エスプレッソはタイムアウトするまで待機します。これはあなたが投稿したエラーを正確に作成します。

テストは時々動作しているので、私はProgressBarの可視性がバックグラウンドタスクに依存していると仮定します。エスプレッソがタイムアウトする前にプログレスバーが隠れている(またはビュー階層から削除されている)場合は、テストが実行されます。

2番目の推測は、バックグラウンドジョブにAsyncTasksを使用していることです。 onResumeが返される前に長時間実行するとAsyncTasksが返された場合、これもあなたが投稿したエラーを作成します。

ProgressBarが完全に削除できるかどうかを確認するか、不確定なドロワブルを静的なドロワブル(つまりColorDrawable)に置き換えるかどうかを確認してください。

1

プロジェクトをクリーンアップしてプロジェクトを作成してください。

また、仮想デバイスまたは物理デバイスのシステムアニメーションをオフにします。

関連する問題