MQTT Service重启会导致 MQTT app崩溃
错误信息:
05-29 07:44:51.882 20450 20816 E CellBroadcastUtils: getDefaultCellBroadcastReceiverPackageName: no package found
05-29 07:44:51.899 27468 27468 E andysong---serviceMainActivity: {websocket_port=8080, port=1883, password_file=/storage/emulated/0/Documents/mqtt/pwd.conf, host=0.0.0.0, persistent_store=/storage/emulated/0/Android/data/com.soft.nice.mqttservice/files/moquette_store.mapdb, acl_file=/storage/emulated/0/Documents/mqtt/acl_file.conf, need_client_auth=true, allow_anonymous=false}
05-29 07:44:51.928 20450 20482 W libprocessgroup: Failed to open /dev/stune/top-app/cgroup.procs: No such file or directory
05-29 07:44:51.969 27468 27468 D CompatibilityChangeReporter: Compat change id reported: 210923482; UID 10023; state: ENABLED
05-29 07:44:52.001 27468 27468 E NiceCIC>>>>>>>>MQTTService: onCreate()
05-29 07:44:52.005 27468 27468 E NiceCIC>>>>>>>>MQTTService: onStart()
05-29 07:44:52.007 27468 27468 D AndroidRuntime: Shutting down VM
05-29 07:44:52.010 27468 27468 E AndroidRuntime: FATAL EXCEPTION: main
05-29 07:44:52.010 27468 27468 E AndroidRuntime: Process: com.soft.nice.mqttservice, PID: 27468
05-29 07:44:52.010 27468 27468 E AndroidRuntime: java.lang.RuntimeException: Unable to start service com.soft.nice.mqttservice.MQTTService@dfce5ed with null: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.Serializable android.content.Intent.getSerializableExtra(java.lang.String)' on a null object reference
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4703)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2181)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7898)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.io.Serializable android.content.Intent.getSerializableExtra(java.lang.String)' on a null object reference
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at com.soft.nice.mqttservice.MQTTService.onStartCommand(MQTTService.java:96)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4685)
05-29 07:44:52.010 27468 27468 E AndroidRuntime: ... 9 more
05-29 07:44:52.018 27468 27468 I Process : Sending signal. PID: 27468 SIG: 9
05-29 07:44:52.044 20450 20852 I ActivityManager: Process com.soft.nice.mqttservice (pid 27468) has died: pers PERU
05-29 07:44:52.046 20376 20376 I Zygote : Process 27468 exited due to signal 9 (Killed)
05-29 07:44:52.046 20450 20479 I libprocessgroup: Successfully killed process cgroup uid 10023 pid 27468 in 0ms
05-29 07:44:52.047 20450 20852 W ActivityManager: Scheduling restart of crashed service com.soft.nice.mqttservice/.MQTTService in 0ms for persistent
05-29 07:44:52.049 20450 20852 W ActivityManager: Re-adding persistent process ProcessRecord{e77529a 27468:com.soft.nice.mqttservice/u0a23}
05-29 07:44:52.052 20450 20852 D CompatibilityChangeReporter: Compat change id reported: 135634846; UID 10023; state: DISABLED
05-29 07:44:52.052 20450 20852 D CompatibilityChangeReporter: Compat change id reported: 177438394; UID 10023; state: DISABLED
05-29 07:44:52.052 20450 20852 D CompatibilityChangeReporter: Compat change id reported: 135772972; UID 10023; state: DISABLED
05-29 07:44:52.052 20450 20852 D CompatibilityChangeReporter: Compat change id reported: 135754954; UID 10023; state: ENABLED
05-29 07:44:52.053 20450 20478 D CompatibilityChangeReporter: Compat change id reported: 143937733; UID 10023; state: ENABLED
- 使用
ps -A | grep com.soft.nice.mqttservice
查询进程号
-
使用
kill -9 26417(进程号)
kill掉进程 -
使用
logcat | grep "andysong"
筛选log信息 -
使用
logcat -c
清空log信息 -
使用
adb shell dumpsys activity services | grep 包名
查看包名下开启的服务 -
使用
adb shell ip -f inet addr|findstr wlan0
查询设备连接的ip地址 -
使用
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED
adb模拟开机广播包
另外一个错误:
E AndroidRuntime: java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: java.lang.ClassNotFoundException: androidx.profileinstaller.ProfileInstallerInitializer
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:7493)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java:6999)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6770)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7898)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: Caused by: androidx.startup.StartupException: java.lang.ClassNotFoundException: androidx.profileinstaller.ProfileInstallerInitializer
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:242)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.content.ContentProvider.attachInfo(ContentProvider.java:2451)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.content.ContentProvider.attachInfo(ContentProvider.java:2421)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:7488)
05-29 08:17:15.946 28157 28157 E AndroidRuntime: ... 11 more