简体   繁体   English

android.app.Activity.performResume中的java.lang.IllegalStateException

[英]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: 我的应用程序在Android 7.0+中崩溃,我使用Firebase JobDispatcher,这是该报告:

java.lang.RuntimeException: java.lang.RuntimeException:

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

Caused by: java.lang.IllegalStateException: 造成原因: java.lang.IllegalStateException:

  1. at android.app.Activity.performResume (Activity.java:7154) 在android.app.Activity.performResume(Activity.java:7154)
  2. at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3850) 在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. 更新:我发现有些设备会在一段时间后强制停止应用程序(华为Y7,iris80 ...),这样做是为了节省电池,我认为这是问题所在。

Description: 描述:

When the activity enters the Resumed state, it comes to the foreground, and then the system invokes the onResume() callback. 当活动进入“恢复”状态时,它进入前台,然后系统调用onResume()回调。 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充当JobScheduler兼容性层,用于定位Android版本低于5.0(API级别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. Firebase JobDispatcher支持将Google Play服务用作调度(运行)作业的实现,但是该库还允许您定义和使用其他实现:例如,您可能决定使用JobScheduler或编写自己的自定义代码。

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. 作为结论的一部分,不要在主线程上运行繁重的代码,这会导致App崩溃并使用新线程实施工具,这对您来说是可行的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android应用程式java.lang.IllegalStateException错误 - Android app java.lang.IllegalStateException error Android,java.lang.IllegalStateException - Android, java.lang.IllegalStateException Android 9 上的 java.lang.IllegalStateException - java.lang.IllegalStateException on Android 9 java.lang.IllegalStateException:片段未附加到android中的Activity问题 - java.lang.IllegalStateException: Fragment not attached to Activity issue in android Android:java.lang.IllegalStateException:无法执行活动的方法 - Android: java.lang.IllegalStateException: Could not execute method of the activity Android java.lang.IllegalStateException:无法执行活动的方法 - Android java.lang.IllegalStateException: Could not execute method of the activity Android中的java.lang.IllegalStateException - java.lang.IllegalStateException In Android 带有viewPager和选项卡的java.lang.IllegalStateException活动 - java.lang.IllegalStateException activity with viewPager and tabs 致命异常:java.lang.IllegalStateException没有活动 - Fatal Exception: java.lang.IllegalStateException No activity android.app.ContextImpl.startServiceCommon中的java.lang.IllegalStateException - java.lang.IllegalStateException at android.app.ContextImpl.startServiceCommon
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM