[Android] 求助安卓开发大佬, App 崩溃,提示启动前台服务失败,问题是我并没有启动前台服务

日志如下:

Time: 2025-05-12 23:41:07
Brand: Xiaomi
Model: 2211133C
Android Version: 13 (SDK 33)
Exception: 
Message:Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{5105f70 u0 com.android.app/.MQTTService}
Stack Trace:
android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{5105f70 u0 com.android.app/.MQTTService}
at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2078)	
at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2052)
at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2314)
at android.os.Handler.dispatchMessage(Handler.java:106)	at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)	
at android.app.ActivityThread.main(ActivityThread.java:8240)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)

从日志看,大概意思是启动前台服务失败,问题时,我程序里根本没有启动前台服务,引用的第三方库,也不会启动前台服务。

这个问题,仅在这个用户出现。

而且诡异的是,正常情况下,app 连续崩溃几次,安卓就会禁止自启动,而这个用户的手机,居然可以一直在自启动,启动后后崩溃,然后继续自启动。

有没有安卓开发的大佬,这是属于什么问题?

原始链接: https://www.v2ex.com/t/1131299#reply0
侵权请联系站方: [email protected]

相关推荐

换一批