How to fix android.os.DeadObjectException android X
Asked Answered
V

2

44

When android unbind a service I created (service.MyService), I see the following DeadObjectException.

Can you please tell me how what does this mean and can I fix this exception?

W/ActivityManager(  583): Exception when unbinding service
com.mycompany/.service.MyService
W/ActivityManager(  583): android.os.DeadObjectException
W/ActivityManager(  583):       at
android.os.BinderProxy.transact(Native Method)
W/ActivityManager(  583):       at
android.app.ApplicationThreadProxy.scheduleUnbindService(ApplicationThreadNative.java:516)
W/ActivityManager(  583):       at
com.android.server.am.ActivityManagerService.removeConnectionLocked(ActivityManagerService.java:9609)
W/ActivityManager(  583):       at
com.android.server.am.ActivityManagerService.killServicesLocked(ActivityManagerService.java:8515)
...

Thank you.

Valorous answered 15/10, 2009 at 16:34 Comment(0)
J
38

This means that your service had already stopped - either killed from the OS, or stopped from your application.

Does this problem happen every time you debug your project?

Override your service's onDestroy() method and watch what event flow leads to it. If you catch DeadObjectException without going through this method, your service should have been killed by the OS.

Jacquettajacquette answered 15/10, 2009 at 19:0 Comment(4)
Does android Service have any onStop() ? I think it is having onDestroy()Favrot
@ShailAdi you are right , there is no opStop for android serviceMorello
The solution then is to kill the service in the hosting activity as that activity gets destroyed?Rinse
its not working . Please provide effective suggestion.Keratogenous
A
1

Had similar logs, and I simply did scroll few hundred log-lines up, and the actual error was there!

I mean, the DeadObjectException is in most cases just a follow-up error, and not the root cause, keep searching the logs upwards ;-)

Are answered 1/10, 2023 at 12:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.