android - YouTubeService 泄露了 IntentReceiver
问题描述
我正在尝试将播放的 youtube 添加到应用程序。
版本:YouTubeAndroidPlayerApi-1.2.2
播放器在布局中添加为
<fragment
android:id="@+id/youtube_video_fragment"
android:name="com.views.video.YouTubePlayerSupportFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
此外,在销毁时释放播放器:
@Override
public void onDestroyView() {
if (youTubePlayer != null) {
youTubePlayer.release();
}
super.onDestroyView();
}
在后台删除父项时,我收到了这个 logcat 错误:
E/ActivityThread: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver acic@3ef7c23 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver acic@3ef7c23 that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:918)
at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:719)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1172)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1152)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1146)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:554)
at adso.<init>(SourceFile:65)
at adtf.get(SourceFile:44)
at anmy.get(SourceFile:10)
at kqu.r(SourceFile:254)
at acgu.get(SourceFile:9)
at anmy.get(SourceFile:10)
at kqw.a(SourceFile:10)
at kpg.<init>(SourceFile:21)
at com.google.android.apps.youtube.embeddedplayer.service.service.jar.ApiPlayerService.<init>(SourceFile:52)
at com.google.android.apps.youtube.embeddedplayer.service.service.jar.ApiPlayerFactoryService$1.run(SourceFile:10)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
看起来 lib 在内部启动 YouTubeService 并且它注册接收器但没有取消注册它。有谁知道如何解决这个问题,或者只有带有修复的新版本库可以提供帮助?
解决方案
推荐阅读
- javascript - Three.js - 从 ZIP 文件加载纹理并解析到 GLTF
- vhdl - 从文本文件读取时需要循环
- python - 如何自定义海岸热图的颜色?
- excel - 以不同方式减去数字的总和
- c++ - 在 C++ 中使用和不使用构造函数调用初始化对象有什么区别
- python - Keras 评估给出的结果与历史不同。哪一个是准确的
- python - 读取包含多个表格的 excel 表格,表格的标题具有非白色背景单元格颜色
- python - 尝试在 Python 中创建文件时,TypeError:必须是 str,而不是 datetime.date
- square-connect - 如何以美元以外的货币创建沙盒支付
- javascript - 无法显示来自数据库数据的图表