在 Youtube Player API 中出现大量崩溃
Posted
技术标签:
【中文标题】在 Youtube Player API 中出现大量崩溃【英文标题】:Getting lot of crashes in Youtube Player API 【发布时间】:2018-02-02 02:18:53 【问题描述】:我已经在安卓应用中实现了 youtube player api。
我在播放视频时经常遇到以下崩溃:
08-03 11:18:25.289 15393 15393 E androidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void iqe.a(boolean)' on a null object reference
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at ioy.onFilterTouchEventForSecurity(SourceFile:115)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2091)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2561)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2199)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2419)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1744)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.app.Activity.dispatchTouchEvent(Activity.java:2771)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:71)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:71)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2380)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.View.dispatchPointerEvent(View.java:9529)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4230)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4096)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3695)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3661)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3787)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3669)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3844)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3695)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3661)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3669)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3642)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5922)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5896)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5857)
08-03 11:18:25.289 15393 15393 E AndroidRuntime: at android.view.ViewRootImpl$WindowInpu
问题是,为了找到崩溃的根本原因,我需要在我的代码中添加一个行号,但崩溃日志只记录在 Google 代码中。
我试图用谷歌搜索这个方法的崩溃:
尝试在 null 上调用虚拟方法“void iqe.a(boolean)” 对象引用
但是,有时使用方法 isu.a(boolean)
而不是 iqe.a(boolean)
会发生此崩溃。
Google 和 *** 没有关于此崩溃或方法的任何内容/信息。
我尝试在整个项目中搜索此方法,但没有任何结果。
由于崩溃日志中没有我的项目中的任何一行,我觉得很难分析出问题所在。
发生崩溃时:
-
播放视频,新活动打开。 > 按返回按钮。
重复步骤 1 10-20 次。
【问题讨论】:
好像和***.com/q/45172972/6305235一样的问题你找到解决办法了吗? @DavidMiguel 是的,崩溃日志是相同的,但是用例不同。如果我找到解决方案,我会发布解决方案。问题依然存在。 创建了一个问题github.com/youtube/yt-android-player/issues/22 【参考方案1】:在 backpress 方法中使用意图
Intent intent=new Intent(Playlist.this,MainActivity.class);
startActivity(intent);
finish();
【讨论】:
这有什么帮助?请解释 您要求后退按钮创建死锁,您可以在您的 backpressed 方法中应用此代码 没有帮助!!以上是关于在 Youtube Player API 中出现大量崩溃的主要内容,如果未能解决你的问题,请参考以下文章
YouTube Player API 在 iframe 中隐藏播放按钮、图标和视频标题
无法使用 YouTube Android Player API 播放某些 Youtube 视频
YouTube Android Player API无法在xiaomi Redmi Note 3中使用
Android YouTube Player API Fragment无法手动处理触摸事件