# Chapter 27: leaked ServiceConnection

**URL:** <https://forums.kodeco.com/t/chapter-27-leaked-serviceconnection/94765>\
**Category:** Android Apprentice\
**Created:** [January 16, 2020, 9:39am UTC](https://forums.kodeco.com/t/chapter-27-leaked-serviceconnection/94765 "2020-01-16T09:39:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![love2anshul](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/love2anshul/32/81494_2.png) [@love2anshul](https://forums.kodeco.com/u/love2anshul)\
**Post date:** [January 16, 2020, 9:39am UTC](https://forums.kodeco.com/t/chapter-27-leaked-serviceconnection/94765/1 "2020-01-16T09:39:14Z")

</div>

Hi,

First of all, thank you very much for this book. I have learnt a lot from it. I am at chapter 27 Episode Player and when I build and run the app I get the following error and app crashes:

2020-01-16 08:58:48.810 30808-30808/raywenderlich.com.podplay E/ActivityThread: Activity raywenderlich.com.podplay.ui.PodcastActivity has leaked ServiceConnection android.media.browse.MediaBrowser$MediaServiceConnection@20b76c9 that was originally bound here  
android.app.ServiceConnectionLeaked: Activity raywenderlich.com.podplay.ui.PodcastActivity has leaked ServiceConnection android.media.browse.MediaBrowser$MediaServiceConnection@20b76c9 that was originally bound here  
at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:1540)  
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1432)  
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1615)  
at android.app.ContextImpl.bindService(ContextImpl.java:1567)  
at android.content.ContextWrapper.bindService(ContextWrapper.java:694)  
at android.media.browse.MediaBrowser$1.run(MediaBrowser.java:187)  
at android.os.Handler.handleCallback(Handler.java:794)  
at android.os.Handler.dispatchMessage(Handler.java:99)  
at android.os.Looper.loop(Looper.java:176)  
at android.app.ActivityThread.main(ActivityThread.java:6651)  
at java.lang.reflect.Method.invoke(Native Method)  
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)  
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)

Could you please help me fix this issue?

Thanks  
Anshul

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [March 29, 2020, 9:21pm UTC](https://forums.kodeco.com/t/chapter-27-leaked-serviceconnection/94765/2 "2020-03-29T21:21:05Z")

</div>

@tblank Can you please help with this when you get a chance? Thank you - much appreciated! :]

---

<div class="post-metadata">

**Author:** ![tblank](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/tblank/32/77655_2.png) [@tblank](https://forums.kodeco.com/u/tblank)\
**Post date:** [March 31, 2020, 3:13am UTC](https://forums.kodeco.com/t/chapter-27-leaked-serviceconnection/94765/3 "2020-03-31T03:13:21Z")

</div>

Hi Ashnul,

Thank you for reading the Android Apprentice, and I’m glad you are enjoying it so far!

I’m sorry to see that you are having an issue in Chapter 27. If you will please answer the following questions, I can help track down the possible cause for your issue.

1. Does the same error occur if you run the final project from the downloadable book source code? If the error doesn’t occur, then I would try to do a comparison of your own project to the published final project code and see if you can spot any differences.

2. If you are getting the error using the published final project, then please let me know what version of Android you are running on your emulator or device.

Thank you,  
Tom
