Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YouTubeAndroidPlayerAPI] YouTubeService has leaked IntentReceiver #166

Open
guilhermesgb opened this issue Feb 4, 2018 · 8 comments
Open

Comments

@guilhermesgb
Copy link

I'm seeing the following issue happening sometimes:

E/ActivityThread: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver vsl@25bf10e 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 vsl@25bf10e that was originally registered here. Are you missing a call to unregisterReceiver()?
                      at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1351)
                      at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1132)
                      at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1421)
                      at android.app.ContextImpl.registerReceiver(ContextImpl.java:1394)
                      at android.app.ContextImpl.registerReceiver(ContextImpl.java:1382)
                      at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:609)
                      at vsj.<init>(SourceFile:21)
                      at vsq.get(SourceFile:9)
                      at wzg.get(SourceFile:31)
                      at adzu.get(SourceFile:10)
                      at hog.a(SourceFile:26)
                      at hpb.a(SourceFile:881)
                      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:790)
                      at android.os.Handler.dispatchMessage(Handler.java:99)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6494)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
E/ActivityThread: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver vsi@d2cf74b 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 vsi@d2cf74b that was originally registered here. Are you missing a call to unregisterReceiver()?
                      at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1351)
                      at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1132)
                      at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1421)
                      at android.app.ContextImpl.registerReceiver(ContextImpl.java:1394)
                      at android.app.ContextImpl.registerReceiver(ContextImpl.java:1382)
                      at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:609)
                      at wyy.<init>(SourceFile:53)
                      at wzg.get(SourceFile:32)
                      at adzu.get(SourceFile:10)
                      at hog.a(SourceFile:26)
                      at hpb.a(SourceFile:881)
                      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:790)
                      at android.os.Handler.dispatchMessage(Handler.java:99)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6494)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Even though this is happening under the hood, it doesn't seem to impact the player, as I can still play videos normally. I've seen just another person reporting this on StackOverflow almost two years ago, so I wonder if this is my fault somehow?...

I am paying close attention to the context lifecycle (the parent context where my player is located) which is actually a Fragment containing a ViewPager, with the first page being the only one to contain my YouTubePlayerSupportFragment. I'm initializing and releasing the player in the appropriate places:

    @Override
    public void onStart() {
        super.onStart();
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
            initPlayer();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        if ((Build.VERSION.SDK_INT <= Build.VERSION_CODES.M)) {
            if (player == null) {
                initPlayer();
            }
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
            if (player != null) {
                player.release();
                player = null;
            }
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
            if (player != null) {
                player.release();
                player = null;
            }
        }
    }

So any help on mitigating this issue will be very much appreciated.

@aman-ar
Copy link

aman-ar commented Mar 29, 2018

Getting the same issue with my app

@gonzalonm
Copy link

Same thing here..

@BMarton
Copy link

BMarton commented Nov 12, 2018

Did you guys find out anything? I'm getting the same error.

@ikram0788
Copy link

I am also getting the same error

@RomanSytnyk
Copy link

Getting the same issue

@MrAndrew
Copy link

Over a year old, any news or updates on this?

@payne-miller-ck
Copy link

Any updates on this issue? I am experiencing the same issue within an app I am working on. For my particular instance, it only occurs on a Google Pixel (1st Generation) running Android 10. This crash happens within a Google Chrome browser that has no other tabs open, while running no other apps on the phone. Any information would be greatly appreciated!

2019-11-25 13:58:54.358 14281-14281/? E/ActivityThread: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver ahop@1326d50 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 ahop@1326d50 that was originally registered here. Are you missing a call to unregisterReceiver()?
        at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1588)
        at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1368)
        at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1515)
        at android.app.ContextImpl.registerReceiver(ContextImpl.java:1488)
        at android.app.ContextImpl.registerReceiver(ContextImpl.java:1476)
        at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:627)
        at ajiv.<init>(PG:44)
        at ajke.get(PG:35)
        at bdcx.get(PG:6)
        at bdcw.get(PG:3)
        at mwx.G(PG:155)
        at ahng.a(PG:5)
        at ahng.get(PG:4)
        at bdcx.get(PG:6)
        at mwz.a(PG:3)
        at muc.<init>(PG:16)
        at com.google.android.apps.youtube.embeddedplayer.service.service.jar.ApiPlayerService.<init>(PG:43)
        at com.google.android.apps.youtube.embeddedplayer.service.service.jar.ApiPlayerFactoryService$1.run(PG:2)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
2019-11-25 13:58:54.360 14281-14281/? E/ActivityThread: Service com.google.android.youtube.api.service.YouTubeService has leaked IntentReceiver ahor@92cc8b4 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 ahor@92cc8b4 that was originally registered here. Are you missing a call to unregisterReceiver()?
        at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1588)
        at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1368)
        at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1515)
        at android.app.ContextImpl.registerReceiver(ContextImpl.java:1488)
        at android.app.ContextImpl.registerReceiver(ContextImpl.java:1476)
        at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:627)
        at ahor.a(PG:12)
        at ahow.<init>(PG:11)
        at ahox.a(PG:9)
        at ajke.get(PG:33)
        at bdcx.get(PG:6)
        at bdcw.get(PG:3)
        at mwx.G(PG:155)
        at ahng.a(PG:5)
        at ahng.get(PG:4)
        at bdcx.get(PG:6)
        at mwz.a(PG:3)
        at muc.<init>(PG:16)
        at com.google.android.apps.youtube.embeddedplayer.service.service.jar.ApiPlayerService.<init>(PG:43)
        at com.google.android.apps.youtube.embeddedplayer.service.service.jar.ApiPlayerFactoryService$1.run(PG:2)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

@MatanKoby
Copy link

Hi, I see this issue as well and would love a fix.
Is the Youtube SDK for Android still maintained and given attention to by Youtube?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants