更新谷歌播放服务后应用程序崩溃

时间:2017-06-20 13:40:11

标签: android google-play-services firebase-cloud-messaging android-notifications

我已使用Firebase在我的应用程序中实现了通知,而在Firebase文档中,它建议您在使用通知时需要检查Google Play服务。

我已实施支票:

  public static void checkGooglePlayServices(final Activity activity) {
    GoogleApiAvailability.getInstance().makeGooglePlayServicesAvailable(activity);
  }

如果Google Play服务已过期,用户会收到更新对话框。如果用户跟进并更新了Google Play服务,则返回应用程序(更新完成后),并且用户返回上一个活动,我将在下面发生崩溃:

Fatal Exception: java.lang.RuntimeException: Unable to destroy activity {com.example.app/com.example.app.settings.notifications.NotificationSettingsActivity}: java.lang.IllegalStateException: Task is already complete
   at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3975)
   at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3993)
   at android.app.ActivityThread.access$1400(ActivityThread.java:178)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1524)
   at android.os.Handler.dispatchMessage(Handler.java:111)
   at android.os.Looper.loop(Looper.java:194)
   at android.app.ActivityThread.main(ActivityThread.java:5637)
   at java.lang.reflect.Method.invoke(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by java.lang.IllegalStateException: Task is already complete
   at com.google.android.gms.common.internal.zzac.zza(Unknown Source)
   at com.google.android.gms.tasks.zzh.zzTH(Unknown Source)
   at com.google.android.gms.tasks.zzh.setException(Unknown Source)
   at com.google.android.gms.tasks.TaskCompletionSource.setException(Unknown Source)
   at com.google.android.gms.internal.zzabj.onDestroy(Unknown Source)
   at com.google.android.gms.internal.zzabu.onDestroy(Unknown Source)
   at android.support.v4.app.Fragment.performDestroy(Fragment.java:2434)
   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1442)
   at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
   at android.support.v4.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:2951)
   at android.support.v4.app.FragmentController.dispatchDestroy(FragmentController.java:271)
   at android.support.v4.app.FragmentActivity.onDestroy(FragmentActivity.java:390)
   at android.support.v7.app.AppCompatActivity.onDestroy(AppCompatActivity.java:209)
   at com.example.app.base.view.BaseActivity.onDestroy(BaseActivity.java:72)
   at android.app.Activity.performDestroy(Activity.java:6291)
   at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1148)
   at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3962)
   at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3993)
   at android.app.ActivityThread.access$1400(ActivityThread.java:178)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1524)
   at android.os.Handler.dispatchMessage(Handler.java:111)
   at android.os.Looper.loop(Looper.java:194)
   at android.app.ActivityThread.main(ActivityThread.java:5637)
   at java.lang.reflect.Method.invoke(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

我不知道为什么我会遇到这次崩溃以及在哪里处理它?<​​/ p>

0 个答案:

没有答案