YouTubeService泄漏了IntentReceiver

时间:2019-01-15 14:51:07

标签: android android-youtube-api

我正在尝试将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,它注册接收者,但不注销它。 有谁知道如何解决这个问题,还是只有新版本的带修复功能的库才能提供帮助?

0 个答案:

没有答案