问题详细描述 Detailed description of the problem
在插件中service调用startForeGround会出现崩溃问题。
复现问题步骤 Steps to reproduce the problem
- 用startServiceForeGround调起service
- service中调用startForeGorund
其它重要信息 Other important information
replugin-host-lib/gradle Version:2.3.2
rePlugin-plugin-lib/gradle Version:2.3.2
Android API Version:
Android 手机型号&ROM(Phone model & ROM):
Logcat上下文 Logcat context
会出现很多如下的错误
06-27 18:06:29.928 11390-11390/com E/RePlugin.ws001: pss.isinl e:
java.lang.NullPointerException: Attempt to invoke virtual method 'androidx.work.impl.Processor androidx.work.impl.WorkManagerImpl.getProcessor()' on a null object reference
at androidx.work.impl.background.systemalarm.SystemAlarmDispatcher.(SystemAlarmDispatcher.java:85)
at androidx.work.impl.background.systemalarm.SystemAlarmDispatcher.(SystemAlarmDispatcher.java:72)
at androidx.work.impl.background.systemalarm.SystemAlarmService.onCreate(SystemAlarmService.java:44)
at com.qihoo360.replugin.component.service.server.PluginServiceServer.installServiceLocked(PluginServiceServer.java:453)
at com.qihoo360.replugin.component.service.server.PluginServiceServer.access$000(PluginServiceServer.java:67)
at com.qihoo360.replugin.component.service.server.PluginServiceServer$2.call(PluginServiceServer.java:399)
at com.qihoo360.replugin.component.service.server.PluginServiceServer$2.call(PluginServiceServer.java:396)
at com.qihoo360.replugin.base.ThreadUtils.syncToMainThread(ThreadUtils.java:50)
at com.qihoo360.replugin.component.service.server.PluginServiceServer.installServiceIfNeededLocked(PluginServiceServer.java:396)
at com.qihoo360.replugin.component.service.server.PluginServiceServer.startServiceLocked(PluginServiceServer.java:136)
at com.qihoo360.replugin.component.service.server.PluginServiceServer$Stub.startService(PluginServiceServer.java:550)
at com.qihoo360.replugin.component.service.PluginServiceClient.startService(PluginServiceClient.java:106)
at com.qihoo360.loader2.PluginContext.startService(PluginContext.java:508)
at androidx.work.impl.background.systemalarm.ConstraintProxy.onReceive(ConstraintProxy.java:37)
at androidx.work.impl.background.systemalarm.ConstraintProxy$NetworkStateProxy.onReceive(ConstraintProxy.java:61)
at com.qihoo360.replugin.component.receiver.PluginReceiverHelper$1.run(PluginReceiverHelper.java:95)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:5541)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
出现下面的starForeGround错误
06-27 18:06:30.088 10902-10902/com.vidmate:p1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xx:p1, PID: 10902
java.lang.NullPointerException: class name is null
at android.content.ComponentName.(ComponentName.java:63)
at android.app.Service.startForeground(Service.java:651)
at com.xx.download.service.DownloadService.startForeground(DownloadService.java:141)
at com.xx.download.service.DownloadService.onStartCommand(DownloadService.java:118)
at com.qihoo360.replugin.component.service.server.PluginServiceServer$1.handleMessage(PluginServiceServer.java:111)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:5541)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
我在插件里 startForegroundService 根本就启动不了服务, startService就能启动。
我在插件里 startForegroundService 根本就启动不了服务, startService就能启动。
请问你解决了吗?