Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

App crashes when I click on the Hourly Button.

My app starts smoothly at first. The 7 day button works fine and is responsive but as soon as I click the hourly button, the app crashes. The logs display this: "channel '6d47869 com.example.mudu.raid/com.example.mudu.raid.ui.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed! Please help. This has been bothering me for a while now.

4 Answers

Hi there,

Are there other error messages? That one is usually output post-crash when an input event is triggered but the target has vanished. So, your button has gone, due to the crash, the channel is cleared. You may find an alternative error occurring earlier than this one detailing the reason for the crash like a NullPointerException or such like.

Steve.

Thanks for the immediate response. These are the stuff that appear on my logs after clicking the hourly button and after the crash.

06-05 10:47:31.254 726-1402/system_process W/ActivityManager:   Force finishing activity 2 com.example.mudu.raid/.ui.MainActivity
06-05 10:47:35.598 726-853/system_process W/InputDispatcher: channel '30e264da com.example.mudu.raid/com.example.mudu.raid.ui.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
06-05 10:47:35.598 726-853/system_process E/InputDispatcher: channel '30e264da com.example.mudu.raid/com.example.mudu.raid.ui.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
06-05 10:47:35.608 726-1401/system_process I/WindowState: WIN DEATH: Window{30e264da u0 com.example.mudu.raid/com.example.mudu.raid.ui.MainActivity}
06-05 10:47:35.608 726-1401/system_process W/InputDispatcher: Attempted to unregister already unregistered input channel '30e264da com.example.mudu.raid/com.example.mudu.raid.ui.MainActivity (server)'

This is an interesting one! I'll confess I have no idea what is causing this but most threads I can find seem to lean towards there being a memory leak. This eventually causes Android to kill your processes with the 'force finishing activity' message.

To test this, and hopefully move nearer a solution, there's a memory usage monitor in Android Studio. Give that a go to see if your app hogs large amounts of memory before the system force stops it.

I'll continue looking for a solution but if it is memory related, I'll need your project, probably. Do you have it in an updated Github repo?

Steve.

thanks Steve. I will try out the memory usage monitor in android studio for the time being. and sorry I don't have my project in a Github repo. I will eventually. thanks again for the help

Let me know how you get on. The memory monitor is part of the debugger so run the app from the debugger and watch the usage level in there are you click through your activities. If the usage gets too high, we know what we're dealing with. If it doesn't, I'll have another think!

A Github repo would be really useful as I can pull your code down and replicate the issue here. I'm happy to spend a bit of time trying to figure out the problem.

Good luck!

Steve.