Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android8.0上 静默恢复失效 #31

Open
rorschach opened this issue Jul 25, 2018 · 4 comments
Open

Android8.0上 静默恢复失效 #31

rorschach opened this issue Jul 25, 2018 · 4 comments

Comments

@rorschach
Copy link

rorschach commented Jul 25, 2018

Crash log

07-25 21:06:58.478 18718-18718/? W/System.err: java.lang.IllegalAccessException: java.lang.Class<com.android.internal.os.RuntimeInit$UncaughtHandler> is not accessible from java.lang.Class<com.zxy.recovery.c.a>
07-25 21:06:58.479 18718-18718/? W/System.err: at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at com.zxy.recovery.c.a.a(MyApplication:26)
at com.zxy.recovery.c.a.a(MyApplication:37)
at com.zxy.recovery.core.c.uncaughtException(MyApplication:99)
at com.tencent.bugly.crashreport.crash.f.b(MyApplication:354)
at com.tencent.bugly.crashreport.crash.f.uncaughtException(MyApplication:372)
at com.amap.api.a.a.iv.uncaughtException(Unknown Source)
at com.amap.api.a.a.jm.uncaughtException(Unknown Source)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
07-25 21:06:58.651 19636-19636/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.plusmoney.managerplus:recover, PID: 19636
java.lang.RuntimeException: Unable to start service com.zxy.recovery.core.RecoveryService@c36d447 with Intent { cmp=com.plusmoney.managerplus/com.zxy.recovery.core.RecoveryService (has extras) }: com.zxy.recovery.b.a: The context is not initialized
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3495)
at android.app.ActivityThread.-wrap23(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1674)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Caused by:

我们为应用的正式版开启了静默恢复,结果不生效;在开发版上使用非静默恢复是生效的。
代码如下:

Recovery.getInstance()
.debug(IS_DEV)
//开发版开启调试页面,生产版启用静默恢复
.silent(!IS_DEV, Recovery.SilentMode.RECOVER_TOP_ACTIVITY)
.recoverInBackground(false)
.init(appContext);

这个应该与Android8.0的Service机制相关吧?

在 Android 8.0 之前,创建前台服务的方式通常是先创建一个后台服务,然后将该服务推到前台。
Android 8.0 有一项复杂功能;系统不允许后台应用创建后台服务。 因此,Android 8.0 引入了一种全新的方法,即 Context.startForegroundService(),以在前台启动新服务。
在系统创建服务后,应用有五秒的时间来调用该服务的 startForeground() 方法以显示新服务的用户可见通知。
如果应用在此时间限制内未调用 startForeground(),则系统将停止服务并声明此应用为 ANR。

@rorschach rorschach changed the title Android8.0上 失效 Android8.0上 静默恢复失效 Jul 25, 2018
@rorschach
Copy link
Author

@Sunzxyong 这个问题导致我们线上的产品出现了其他的问题,能够尽快修复一下?

@rorschach
Copy link
Author

我们的产品同时接入了Bugly,导致这个问题的原因是否为Recovery与Bugly冲突?

@Sunzxyong
Copy link
Owner

@rorschach 不好意思,最近太忙,这个和bugly没有冲突,会这两天修复

@Sunzxyong
Copy link
Owner

@rorschach 请更新到v1.0.0版本。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants