适用于Android的YouTube播放器在广告播放时崩溃

我们使用Android Youtube API输入输出应用程序.最近,我注意到每次尝试播放启用了广告的视频时,应用程序都会崩溃.

我可以使用他们的sample applications重现它.我已经尝试过SimplePlayerFragment和SimplePlayerView示例.当我尝试提示http://www.youtube.com/watch?v=QudbrUcVPxk视频时,两者都崩溃(这只是一个例子,其他带有广告的视频也都失败了).

这是LogCat的输出:

10-26 19:10:49.074: E/AndroidRuntime(21637): FATAL EXCEPTION: main
10-26 19:10:49.074: E/AndroidRuntime(21637):
java.lang.IllegalStateException: android.os.DeadObjectException 10-26
19:10:49.074: E/AndroidRuntime(21637): at
com.google.android.apps.youtube.api.jar.a.eo.surfaceDestroyed(SourceFile:236)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.view.SurfaceView.updateWindow(SurfaceView.java:555) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:232)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.view.View.dispatchDetachedFromWindow(View.java:12156) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2565)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2565)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.view.ViewGroup.removeViewInternal(ViewGroup.java:3785) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.view.ViewGroup.removeViewInternal(ViewGroup.java:3758) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.view.ViewGroup.removeView(ViewGroup.java:3690) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
com.google.android.youtube.player.YouTubePlayerView$1.b(Unknown
Source) 10-26 19:10:49.074: E/AndroidRuntime(21637): at
com.google.android.youtube.player.internal.r.h(Unknown Source) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
com.google.android.youtube.player.internal.r$e.onServiceDisconnected(Unknown
Source) 10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1111)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1125)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.os.Handler.handleCallback(Handler.java:730) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.os.Handler.dispatchMessage(Handler.java:92) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
android.os.Looper.loop(Looper.java:137) 10-26 19:10:49.074:
E/AndroidRuntime(21637): at
android.app.ActivityThread.main(ActivityThread.java:5103) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
java.lang.reflect.Method.invokeNative(Native Method) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
java.lang.reflect.Method.invoke(Method.java:525) 10-26 19:10:49.074:
E/AndroidRuntime(21637): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-26 19:10:49.074: E/AndroidRuntime(21637): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
dalvik.system.NativeStart.main(Native Method) 10-26 19:10:49.074:
E/AndroidRuntime(21637): Caused by: android.os.DeadObjectException
10-26 19:10:49.074: E/AndroidRuntime(21637): at
android.os.BinderProxy.transact(Native Method) 10-26 19:10:49.074:
E/AndroidRuntime(21637): at
com.google.android.apps.youtube.api.b.a.be.a(SourceFile:221) 10-26
19:10:49.074: E/AndroidRuntime(21637): at
com.google.android.apps.youtube.api.jar.a.eo.surfaceDestroyed(SourceFile:233)
10-26 19:10:49.074: E/AndroidRuntime(21637): … 22 more

我将对解决问题的任何想法表示赞赏.

UPD:

感谢@septagon,找到了另一个相关的LogCat消息:

10-27 16:58:51.763: D/YouTubeAndroidPlayerAPI(25196):
apps.youtube.core.client.DefaultAdStatsClient.a:485 Pinging
__AWCl-JGAkAHIAQWpAn4krwpwE7A-4AIAqAMBmAQFqgSwAU_QADdeVEnDazwBrSnaYs3R1HBqy45Cu537TEJ3YTBlvSni0sRdoz7KdLcSM8GN-htn40LlHEa78Q0Wc-Hrk04QcefoGDWqXcyn7fC6U9J6CfOz_J6n509CB7hJfQX2xrj2YTLwO2_AeK-bj9k3KWULoKQv_ZBYw5PfzGYPi2xuSOmQuuFoYcr0atVp-oLKiFDMrNiGhAsjaCbg8jlG43cEZZZ-VSGq1f9Oz1b-XQKw4AQBiAXhiftBkgUGCAMQARgBkgUGCAQQBRgKkgUGCAQQARgBkgUGCAYQARgBkgUECAYYA5AGAaAGHNgGAoAHuaXfLA&sigh=PjCzMkHYDKo&cid=5Gi9PCMcr3WKhFJWqILtjrdq&template_id=213″>http://pubads.g.doubleclick.net/pagead/adview?ai=Cr6PgkatsUt7LE8GpmgXc3oHwBbGx9t8DsZHlu3Kx0vmLARABIOP7kwNQ4vr5ivj___AWCl-JGAkAHIAQWpAn4krwpwE7A-4AIAqAMBmAQFqgSwAU_QADdeVEnDazwBrSnaYs3R1HBqy45Cu537TEJ3YTBlvSni0sRdoz7KdLcSM8GN-htn40LlHEa78Q0Wc-Hrk04QcefoGDWqXcyn7fC6U9J6CfOz_J6n509CB7hJfQX2xrj2YTLwO2_AeK-bj9k3KWULoKQv_ZBYw5PfzGYPi2xuSOmQuuFoYcr0atVp-oLKiFDMrNiGhAsjaCbg8jlG43cEZZZ-VSGq1f9Oz1b-XQKw4AQBiAXhiftBkgUGCAMQARgBkgUGCAQQBRgKkgUGCAQQARgBkgUGCAYQARgBkgUECAYYA5AGAaAGHNgGAoAHuaXfLA&sigh=PjCzMkHYDKo&cid=5Gi9PCMcr3WKhFJWqILtjrdq&template_id=213
10-27 16:58:51.763: D/AndroidRuntime(25196): Shutting down VM 10-27
16:58:51.763: W/dalvikvm(25196): threadid=1: thread exiting with
uncaught exception (group=0x4158d700) 10-27 16:58:51.773:
E/AndroidRuntime(25196): FATAL EXCEPTION: main 10-27 16:58:51.773:
E/AndroidRuntime(25196): java.lang.NullPointerException 10-27
16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.player.AdStatsMacros.a(SourceFile:185)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.client.DefaultAdStatsClient.a(SourceFile:481)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.client.DefaultAdStatsClient.a(SourceFile:467)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.client.DefaultAdStatsClient.a(SourceFile:461)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.client.DefaultAdStatsClient.h(SourceFile:320)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.player.StatsTracker.g(SourceFile:409)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.google.android.apps.youtube.core.player.an.handleMessage(SourceFile:1615)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
android.os.Handler.dispatchMessage(Handler.java:95) 10-27
16:58:51.773: E/AndroidRuntime(25196): at
android.os.Looper.loop(Looper.java:137) 10-27 16:58:51.773:
E/AndroidRuntime(25196): at
android.app.ActivityThread.main(ActivityThread.java:5103) 10-27
16:58:51.773: E/AndroidRuntime(25196): at
java.lang.reflect.Method.invokeNative(Native Method) 10-27
16:58:51.773: E/AndroidRuntime(25196): at
java.lang.reflect.Method.invoke(Method.java:525) 10-27 16:58:51.773:
E/AndroidRuntime(25196): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-27 16:58:51.773: E/AndroidRuntime(25196): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-27
16:58:51.773: E/AndroidRuntime(25196): at
dalvik.system.NativeStart.main(Native Method)

解决方法:

There is bug filed in public issue tracker.

You can track the progress from there.

错误也在内部提交.

上一篇:如何在树莓派上安装python 3和setuptools?


下一篇:javascript-从UIWebView知道何时开始播放YouTube视频