DeadObjectException与com.google.android.gms [英] DeadObjectException with com.google.android.gms

查看:122
本文介绍了DeadObjectException与com.google.android.gms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面的日志中遇到了一个频繁的崩溃。它没有引用我的应用程序代码,但我猜这可能与GoogleApiClient连接/断开有关。任何人都能得到类似的东西吗?

I'm getting a frequent crash with the log below. It doesn't reference my application code but I'm guessing it may have something to do with GoogleApiClient connecting/disconnecting. Anyone get anything similar to this? I haven't been able to find anything on here.

java.lang.IllegalStateException: android.os.DeadObjectException
  at com.google.android.gms.internal.ao.removeAllListeners(Unknown Source)
  at com.google.android.gms.internal.ap.disconnect(Unknown Source)
  at com.google.android.gms.common.api.b.n(Unknown Source)
  at com.google.android.gms.common.api.b.a(Unknown Source)
  at com.google.android.gms.common.api.b$2.onConnectionSuspended(Unknown Source)
  at com.google.android.gms.internal.r.y(Unknown Source)
  at com.google.android.gms.internal.q$a.handleMessage(Unknown Source)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:136)
  at android.app.ActivityThread.main(ActivityThread.java:5102)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:515)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
  at dalvik.system.NativeStart.main(Native Method)
Caused by: android.os.DeadObjectException
  at android.os.BinderProxy.transact(Native Method)
  at com.google.android.gms.internal.an$a$a.a(Unknown Source)
  ... 15 more

可能发生在哪里。我添加了一个try / catch来捕获异常

Possibly where it's happening. I added a try/catch to catch the exception

mGApiClientMgr.addTask(mGApiClientMgr.new GoogleApiClientTask() {
            @Override
            public void run() {
                Log.d(LOG_TAG, "Refreshing data set.");
                Location location;
                try {
                    location = LocationServices.FusedLocationApi.getLastLocation(getGoogleApiClient());
                    onLocationChanged(location);
                }
                catch(IllegalStateException ex) {
                    // TODO
                }
            }
        });

其中 addTask 确实:

  private final LinkedBlockingQueue<GoogleApiClientTask> mTaskQueue = new LinkedBlockingQueue
        <GoogleApiClientTask>();

  mTaskQueue.offer(task);


推荐答案

这似乎与处理程序和消息传递有关...基于以下来自堆栈跟踪的片段, gms 正在看到 DeadObjectException 当试图在looper上处理消息 。即使堆栈跟踪显示 gms 相关,它可能会由您的代码触发。

This seems related to handlers and message passing...Based on below snippet from your stack trace, gms is seeing a DeadObjectException when trying to process a message on the looper. Even though the stack trace shows gms related, it could have be triggered by your code.

   at com.google.android.gms.internal.q$a.handleMessage(Unknown Source)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:136)

如果 message 它试图访问属于一个已经退出/终止的进程。做一个代码搜索所有处理程序 sendMessage * 邮件调度电话,通过你的代码。即使这可能无法捕获所有实例,因为一些 gms 调用可能会导致处理函数消息分派。

This exception is seen if the message its trying to access belong to a process that has since exited/killed. Do a code search for all handler sendMessage* message dispatch calls, through out your code. Even this may not catch all instances as some gms calls could result in handler message dispatches.

另外,检查是否有任何后台服务或分配 handler 消息的活动正在退出。 Android可能会销毁它们取决于生命周期状态,请尝试覆盖 onDestroy

Also, check if any of your background services, or activities that allocated handler messages, are exiting. Android could be destroying them depending on life cycle states, try overriding onDestroy.

在所有活动/服务中,您拨打 gms api,检查你创建的对象并传递给 gms ;如果他们死亡,那些对象不再有效。

In all your activities/services, any where you make calls to gms api, check the objects you create and pass to gms; If they die, those objects are not valid any more.

这篇关于DeadObjectException与com.google.android.gms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆