服务com.google.android.youtube.api.service.YouTubeService泄漏了IntentReceiver uds @ 5fa5135 [英] Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver uds@5fa5135

查看:120
本文介绍了服务com.google.android.youtube.api.service.YouTubeService泄漏了IntentReceiver uds @ 5fa5135的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我从后堆栈中删除YouTubePlayerSupportFragment时,都会在logcat中收到以下错误:

Every time I remove the YouTubePlayerSupportFragment from the back stack, I get the error below in the logcat:

06-12 02:08:46.937 8805-8805/ D/GA_DEBUG: Event_category:VideoContent-Portrait-This artist uses unique methods to paint his pottery action:play label:youtube {&el=youtube, &ec=VideoContent-Portrait-This artist uses unique methods to paint his pottery, &t=event, &ea=play, &cd6=online}
06-12 02:08:46.945 10194-10194/? E/ActivityThread: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver uds@5fa5135 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 uds@5fa5135 that was originally registered here. Are you missing a call to unregisterReceiver()?
    at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:946)
    at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:742)
    at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1188)
    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1168)
    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1162)
    at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:555)
    at udq.<init>(SourceFile:21)
    at udx.get(SourceFile:9)
    at vkq.get(SourceFile:31)
    at aces.get(SourceFile:10)
    at hog.a(SourceFile:26)
    at hpb.a(SourceFile:883)
    at hnz.<init>(SourceFile:13)
    at com.google.android.apps.youtube.embeddedplayer.service.service.jar.ApiPlayerService.<init>(SourceFile:60)
    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:152)
    at android.app.ActivityThread.main(ActivityThread.java:5497)
    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)
06-12 02:08:46.968 10194-10194/? E/ActivityThread: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver udp@a7bd896 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 udp@a7bd896 that was originally registered here. Are you missing a call to unregisterReceiver()?
   at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:946)
   at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:742)
   at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1188)
   at android.app.ContextImpl.registerReceiver(ContextImpl.java:1168)
   at android.app.ContextImpl.registerReceiver(ContextImpl.java:1162)
   at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:555)
   at vki.<init>(SourceFile:53)
   at vkq.get(SourceFile:32)
   at aces.get(SourceFile:10)
   at hog.a(SourceFile:26)
   at hpb.a(SourceFile:883)
   at hnz.<init>(SourceFile:13)
   at com.google.android.apps.youtube.embeddedplayer.service.service.jar.ApiPlayerService.<init>(SourceFile:60)
   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:152)
   at android.app.ActivityThread.main(ActivityThread.java:5497)
   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)
06-12 02:08:47.015 8805-8805/I/ResourcesManager: isUpToDate /data/app/com.google.android.youtube-1/base.apk: true

我做错了什么?在删除片段之前,我确实将所有资源设置为null,并在播放器实例上调用了release(),但是此日志仍然存在.

What I am doing wrong? Before removing fragment I did set all resources to null and called release() on the player instance but this log is still there.

推荐答案

在尝试了多种在项目中使用Youtube播放器片段的方法后,我们在回收器视图中显示了视频列表,并且每个视频都可以在原地播放(当然,在时间).

Well after trying multiple ways to use Youtube player fragment in project where we show list of videos in recycler view and each can be played in place (off course one at a time ).

仅管理适当的生命周期(将片段从一个地方移到另一个地方时调用发布)仅在您迅速执行之后才起作用,并且如果您碰巧尝试同时播放2个视频,则会发生上述问题(即,内部youtube sdk在消息队列中泄漏一些触摸事件)

Managing proper life cycle only ( calling release when removing fragment from one place to other ) will work only until you do it rapidly and if you happen to try to play 2 videos simultaneously the above issue will occur (ie internally youtube sdk will leak some touch event in message queue)

,因此,我们仅创建一个片段实例并在应用程序中的所有位置重复使用,而不是为每个视频替换youtube片段,并且如果活动生命周期事件(在暂停/停止或保存的实例状态下)被称为),然后释放该片段,并在恢复时再次创建youtube片段的单个活动实例

so instead of replacing youtube fragments for each video we create only one instance of fragment and reuse it at all places in app and if activity life cycle event (on pause/stop or on saved instance state is called) then we release the fragment and on resume we again create that single active instance of youtube fragment

这种方法实际上已经解决了上述问题 https://issuetracker.google.com/issues/78370483

this approach has practically fixed above issue as well https://issuetracker.google.com/issues/78370483

这篇关于服务com.google.android.youtube.api.service.YouTubeService泄漏了IntentReceiver uds @ 5fa5135的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆