简体   繁体   中英

java.lang.IllegalStateException in android.app.Activity.performResume

My app is crashing in Android 7.0+, I use The Firebase JobDispatcher And this is the report:

java.lang.RuntimeException:

  1. at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3873)
  2. at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:3914)
  3. at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3070)
  4. at android.app.ActivityThread.-wrap14 (ActivityThread.java)
  5. at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1659)
  6. at android.os.Handler.dispatchMessage (Handler.java:102)
  7. at android.os.Looper.loop (Looper.java:154)
  8. at android.app.ActivityThread.main (ActivityThread.java:6816)
  9. at java.lang.reflect.Method.invoke (Native Method)
  10. at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1563)
  11. at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1451)

Caused by: java.lang.IllegalStateException:

  1. at android.app.Activity.performResume (Activity.java:7154)
  2. at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3850)

Update: I found some devices that force stop the app after some time (Huawei Y7, iris80...), They do this to save the battery, I think this is the problem.

Description:

When the activity enters the Resumed state, it comes to the foreground, and then the system invokes the onResume() callback. This is the state in which the app interacts with the user. The app stays in this state until something happens to take focus away from the app. Firebase JobDispatcher serves as a JobScheduler-compatibility layer for apps targeting versions of Android lower than 5.0 (API level 21).

Firebase JobDispatcher supports the use of Google Play services as an implementation for dispatching (running) jobs, but the library also allows you to define and use other implementations: For example, you might decide to use JobScheduler or write your own, custom code.

As part of conclude don't run heavy code on Main Thread it causes App crash take implement with new Thread it's work for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM