构建 Android 应用程序,UI 一秒钟后出现空白并出现一些 BinderProxy 错误

Building an Android app, UI goes blank after a second with some BinderProxy error

我最近几天一直在构建一个应用程序。我收到这个奇怪的错误,打开应用程序后,整个屏幕变白,我什么也做不了。不过,我正常获取日志。似乎整个应用程序都运行良好,只是 UI 变成空白,我认为这与我得到的以下日志有关。

04-14 13:09:43.880:I/art(17944):后台部分并发标记清除 GC 释放了 5065(575KB) 个 AllocSpace 对象,13(584KB) 个 LOS 对象,29% 空闲, 38MB/54MB,暂停 8.631ms 总计 49.204ms

04-14 13:09:49.905:I/Timeline(17944):时间轴:Activity_launch_request id:com.packageName time:8607601

04-14 13:09:50.000: A/Home(17944): isFinishing = false

04-14 13:09:50.040: D/Activity(17944): performCreate Call secproduct 特征值false

04-14 13:09:50.040: D/Activity(17944): performCreate Call debug elastic valuetrue

04-14 13:09:50.150: I/Timeline(17944): 时间轴: Activity_idle id: android.os.BinderProxy@a363fd9 time:8607846

04-14 13:09:50.220: V/ActivityThread(17944): updateVisibility : ActivityRecord{3fd6d07f token=android.os.BinderProxy@47236cc {com.packageName/com.packageName.Home}} 显示:假

请帮帮我。在这里疯了。不知道是什么。

其他一些可能有助于你们理解我的问题的事情是:

  1. 我在 activity 中使用 Facebook 登录,只有当我从 Facebook Activity 切换到这个 activity(大部分)

  2. activity 正在重新创建导致此错误的自身。

  1. 你是否正确使用了setContentView方法来设置layout
  2. 在清单
  3. 中声明activity
  4. 请检查您 class,可能存在任何视图或上下文的空引用
The crash is because the binder you're getting back is an instance of BinderProxy, not your local binder class. This usually happens because your activity is attempting to bind to a service that is not in the same process. When binding across process boundaries, an instance of BinderProxy is used instead of the actual instance (since that's in a different process).

Try this

if(!((Activity) context).isFinishing())
{
    //your code
}

正如我提到的,我正在使用 SensorEventListener,我也在这个之前的 activity 中使用过它。在完成导致此错误的 activity 之前,我没有取消注册监听器。不过谢谢大家给我指明了正确的方向。