Quantcast
Channel: Active questions tagged xts - Stack Overflow
Viewing all articles
Browse latest Browse all 57

junit.framework.AssertionFailedError: Test is stuck, see ANR stack trace for more info. You may need to create /data/anr first

$
0
0

I'm running Test cases but facing the below error.

junit.framework.AssertionFailedError: Test is stuck, see ANR stacktrace for more info. You may need to create /data/anr first

The error occurred in the below code :

for (int i = 0; i < 3; i++) {                initMediaPlayer(mMediaPlayer2);                mOnCompletionCalled.reset();                mOnInfoCalled.reset();                mMediaPlayer.setOnCompletionListener(mp -> {                    assertEquals(mMediaPlayer, mp);                    mOnCompletionCalled.signal();                });                mMediaPlayer2.setOnInfoListener((mp, what, extra) -> {                    assertEquals(mMediaPlayer2, mp);                    if (what == MediaPlayer.MEDIA_INFO_STARTED_AS_NEXT) {                        mOnInfoCalled.signal();                    }                    return false;                });                mMediaPlayer.setNextMediaPlayer(mMediaPlayer2);                mMediaPlayer.start();                assertTrue(mMediaPlayer.isPlaying());                assertFalse(mOnCompletionCalled.isSignalled());                assertFalse(mMediaPlayer2.isPlaying());                assertFalse(mOnInfoCalled.isSignalled());                while(mMediaPlayer.isPlaying()) {                    Thread.sleep(SLEEP_TIME);                }                // wait a little longer in case the callbacks haven't quite made it through yet                Thread.sleep(100);                assertTrue(mMediaPlayer2.isPlaying());                assertTrue(mOnCompletionCalled.isSignalled());                assertTrue(mOnInfoCalled.isSignalled());                // At this point the 1st player is done, and the 2nd one is playing.                // Now swap them, and go through the loop again.                MediaPlayer tmp = mMediaPlayer;                mMediaPlayer = mMediaPlayer2;                mMediaPlayer2 = tmp;            }

Don't know how to fix this one. please help.

I have taken logs:

03-27 16:21:44.615 1010150  3728  3810 E AndroidRuntime: FATAL EXCEPTION: Thread-203-27 16:21:44.615 1010150  3728  3810 E AndroidRuntime: Process: android.media.player.cts, PID: 372803-27 16:21:44.615 1010150  3728  3810 E AndroidRuntime: junit.framework.AssertionFailedError: Test is stuck, see ANR stack trace for more info. You may need to create /data/anr first03-27 16:21:44.615 1010150  3728  3810 E AndroidRuntime:    at junit.framework.Assert.fail(Assert.java:50)03-27 16:21:44.615 1010150  3728  3810 E AndroidRuntime:    at android.media.player.cts.MediaPlayerTest.lambda$testSetNextMediaPlayer$5(MediaPlayerTest.java:785)03-27 16:21:44.615 1010150  3728  3810 E AndroidRuntime:    at android.media.player.cts.MediaPlayerTest$$ExternalSyntheticLambda0.run(Unknown Source:2)03-27 16:21:44.615 1010150  3728  3810 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:1012)03-27 16:21:44.616 1010150  3728  3810 D MonitoringInstr: Handling an uncaught exception thrown on the thread Thread-2.03-27 16:21:44.616 1010150  3728  3810 D MonitoringInstr: junit.framework.AssertionFailedError: Test is stuck, see ANR stack trace for more info. You may need to create /data/anr first03-27 16:21:44.616 1010150  3728  3810 D MonitoringInstr:   at junit.framework.Assert.fail(Assert.java:50)03-27 16:21:44.616 1010150  3728  3810 D MonitoringInstr:   at android.media.player.cts.MediaPlayerTest.lambda$testSetNextMediaPlayer$5(MediaPlayerTest.java:785)03-27 16:21:44.616 1010150  3728  3810 D MonitoringInstr:   at android.media.player.cts.MediaPlayerTest$$ExternalSyntheticLambda0.run(Unknown Source:2)03-27 16:21:44.616 1010150  3728  3810 D MonitoringInstr:   at java.lang.Thread.run(Thread.java:1012)03-27 16:21:44.616 1010150  3728  3810 W AndroidJUnitRunner: An unhandled exception was thrown by the app.

Viewing all articles
Browse latest Browse all 57

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>