Android视频崩溃

时间:2012-01-13 10:51:44

标签: android video

当我试图在10秒内在屏幕上滑动时。在视频播放期间,我收到错误'Activity MyActivity(在应用程序MyActivity中)没有响应'。这个错误在Android 3.2.1上显示(在Android 2.3.3上 - 一切正常)。

AppWindowToken{4171c010 token=ActivityRecord{40a4b008 com.MyActivity/.Home}}.  5018.0ms since event, 5004.9ms since wait started
01-10 14:08:31.280 I/WindowManager(  142): Input event dispatching timed out sending to application AppWindowToken{4171c010 token=ActivityRecord{40a4b008 com.MyActivity/.Home}}
01-10 14:08:31.310 I/Process (  142): Sending signal. PID: 4027 SIG: 3
01-10 14:08:31.310 I/dalvikvm( 4027): threadid=4: reacting to signal 3
01-10 14:08:31.320 I/dalvikvm( 4027): Wrote stack traces to '/data/anr/traces.txt'
01-10 14:08:31.320 I/Process (  142): Sending signal. PID: 142 SIG: 3
01-10 14:08:31.320 I/dalvikvm(  142): threadid=4: reacting to signal 3
01-10 14:08:31.350 I/dalvikvm(  142): Wrote stack traces to '/data/anr/traces.txt'
01-10 14:08:31.350 I/Process (  142): Sending signal. PID: 224 SIG: 3
01-10 14:08:31.350 I/dalvikvm(  224): threadid=4: reacting to signal 3
01-10 14:08:31.360 I/dalvikvm(  224): Wrote stack traces to '/data/anr/traces.txt'
01-10 14:08:31.360 I/Process (  142): Sending signal. PID: 200 SIG: 3
01-10 14:08:31.360 I/dalvikvm(  200): threadid=4: reacting to signal 3
01-10 14:08:31.370 I/dalvikvm(  200): Wrote stack traces to '/data/anr/traces.txt'
01-10 14:08:31.550 D/dalvikvm(  142): GC_CONCURRENT freed 2091K, 40% free  17467K/28679K, paused 5ms+8ms
01-10 14:08:31.690 D/dalvikvm(  142): GC_EXPLICIT freed 303K, 40% free 17465K/28679K, paused 3ms+5ms
01-10 14:08:32.280 E/ActivityManager(  142): ANR in com.MyActivity (com.MyActivity/.Home)
01-10 14:08:32.280 E/ActivityManager(  142): Reason: keyDispatchingTimedOut
01-10 14:08:32.280 E/ActivityManager(  142): Load: 0.41 / 0.3 / 0.18
01-10 14:08:32.280 E/ActivityManager(  142): CPU usage from 26289ms to 0ms ago with 99% awake:
01-10 14:08:32.280 E/ActivityManager(  142):   22% 89/mediaserver: 17% user + 4.6% kernel / faults: 2598 minor
01-10 14:08:32.280 E/ActivityManager(  142):   14% 4027/com.MyActivity: 11% user + 2.6% kernel / faults: 1460 minor
01-10 14:08:32.280 E/ActivityManager(  142):   8.1% 195/dhd_dpc: 0% user + 8.1% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   7.4% 142/system_server: 2.2% user + 5.1% kernel / faults: 96 minor
01-10 14:08:32.280 E/ActivityManager(  142):   2% 86/surfaceflinger: 0.7% user + 1.3% kernel / faults: 2 minor
01-10 14:08:32.280 E/ActivityManager(  142):   1.8% 4000/kworker/u:1: 0% user + 1.8% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   1.7% 2307/kworker/u:0: 0% user + 1.7% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   1.4% 1713/kworker/u:3: 0% user + 1.4% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   0.5% 62/kinteractiveup: 0% user + 0.5% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   0.5% 3541/kworker/u:2: 0% user + 0.5% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   0.4% 224/com.android.phone: 0% user + 0.4% kernel / faults: 1 minor
01-10 14:08:32.280 E/ActivityManager(  142):   0.3% 88/drmserver: 0% user + 0.3% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   0.3% 200/com.android.systemui: 0.2% user + 0% kernel / faults: 32 minor
01-10 14:08:32.280 E/ActivityManager(  142):   0% 222/com.android.launcher: 0% user + 0% kernel / faults: 197 minor
01-10 14:08:32.280 E/ActivityManager(  142):   0.2% 2954/kworker/0:0: 0% user + 0.2% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   0.2% 3584/kworker/1:1: 0.2% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   0% 322/android.process.media: 0% user + 0% kernel / faults: 69 minor
01-10 14:08:32.280 E/ActivityManager(  142):   0.1% 128/irq/182-3d: 0% user + 0.1% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   0.1% 194/dhd_watchdog: 0% user + 0.1% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   0% 1583/avp_svc_thread: 0% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   0% 209/wpa_supplicant: 0% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   0% 2556/ksoftirqd/1: 0% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142): 30% TOTAL: 16% user + 11% kernel + 0.4% iowait + 1.7% softirq
01-10 14:08:32.280 E/ActivityManager(  142): CPU usage from 417ms to 950ms later:
01-10 14:08:32.280 E/ActivityManager(  142):   20% 89/mediaserver: 20% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142):     7.2% 4075/TimedEventQueue: 7.2% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142):     7.2% 4081/AudioTrackThrea: 7.2% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142):     3.6% 138/Playback Thread: 3.6% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142):     1.8% 4071/TimedEventQueue: 1.8% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   10% 142/system_server: 0% user + 10% kernel / faults: 1 minor
01-10 14:08:32.280 E/ActivityManager(  142):     7.2% 173/InputDispatcher: 0% user + 7.2% kernel
01-10 14:08:32.280 E/ActivityManager(  142):     3.6% 174/InputReader: 1.8% user + 1.8% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   1.1% 86/surfaceflinger: 1.1% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142):     1.1% 118/SurfaceFlinger: 1.1% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   1.2% 195/dhd_dpc: 0% user + 1.2% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   1.8% 1713/kworker/u:3: 0% user + 1.8% kernel
01-10 14:08:32.280 E/ActivityManager(  142):   1.8% 4027/com.MyActivity: 0% user + 1.8% kernel / faults: 5 minor
01-10 14:08:32.280 E/ActivityManager(  142):     1.8% 4027/com.MyActivity: 1.8% user + 0% kernel
01-10 14:08:32.280 E/ActivityManager(  142): 23% TOTAL: 12% user + 10% kernel
01-10 14:08:32.290 W/webview ( 4027): Got ACTION_DOWN but still waiting on stale event. Catching up.
01-10 14:08:32.360 D/dalvikvm( 4027): GC_CONCURRENT freed 412K, 7% free 7147K/7623K, paused 2ms+8ms
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_DOWN received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_POINTER_DOWN(0) received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_POINTER_DOWN(0) received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_MOVE received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_POINTER_UP(0) received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_POINTER_UP(0) received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_POINTER_DOWN(0) received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_MOVE received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_POINTER_DOWN(0) received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_MOVE received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_POINTER_UP(0) received from webcore; ignoring
01-10 14:08:32.590 W/webview ( 4027): Stale touch event ACTION_POINTER_UP(0) received from webcore; ignoring
01-10 14:08:35.430 W/ActivityManager(  142):   Force finishing activity com.MyActivity/.Home
01-10 14:08:35.470 I/Process (  142): Sending signal. PID: 4027 SIG: 9
01-10 14:08:35.470 I/ActivityManager(  142): Killing com.MyActivity (pid=4027): user's request
01-10 14:08:35.490 I/AwesomePlayer(   89): reset
01-10 14:08:35.490 I/WindowManager(  142): WIN DEATH: Window{41363c38 com.MyActivity/com.MyActivity.Home paused=true}
01-10 14:08:35.490 I/ActivityManager(  142): Process com.MyActivity (pid 4027) has died.
01-10 14:08:35.500 I/AwesomePlayer(   89): cancel player events

代码:

private void showVideo(String url) {
    if (videoView != null) 
    return;

    videoView = (VideoView) findViewById(R.id.video_view);
    findViewById(R.id.close_button).setVisibility(View.VISIBLE);
    videoView.setVisibility(View.VISIBLE);

    MediaController mediaController = new MediaController(this);
    mediaController.setAnchorView(findViewById(R.id.root_view));
    Uri video = Uri.parse(url);
    videoView.setMediaController(mediaController);
    videoView.setVideoURI(video);
    videoView.start();
    videoView.setOnCompletionListener(new OnCompletionListener() {
    public void onCompletion(MediaPlayer mp) {
            videoView.setVisibility(View.GONE);
            videoView = null;
            findViewById(R.id.close_button).setVisibility(View.GONE);
    }
    });
}

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

错误“Activity MyActivity(在应用程序MyActivity中)没有响应”意味着您在主应用程序线程上花费了太多时间。如果您尝试使用模拟器,可能只是因为您的PC不够快,无法很好地运行3.2模拟器。

否则,您只需确定在主应用程序线程上花费时间的位置,无论是使用LogCat,Traceview,StrictMode还是其他方式。