Caused by: java.lang.IllegalStateException: Not allowed to start service Intent

Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=package/xxx.xxxService }: app is in background uid UidRecord


Android 8.0(+)不允许在后台启动/创建Service,直接调用context.startService(intent)会宕机。

临时解决办法:

将编译版本和目标版本降级到25,就可以避免因为8.0(26)不允许APP在后台启动Service而宕机。因为系统版本向后兼容。


猜你喜欢

转载自blog.csdn.net/mike_modern/article/details/80024464