android 解决 adb命令启动service报app is in background uid null

启动service有两种命令:

1. adb shell am startservice -n 包名/类名

2. adb shell am startservice -a service_action

但是偶尔会报错:

app is in background uid null

这里记录下解决方法,启动命令改为:

1. adb shell am start-foreground-service -n 包名/类名

2. adb shell am start-foreground-service -a service_action

举个例:

adb shell am start-foreground-service -n com.demo.xxx/com.demo.xxx.MyService

你可能感兴趣的:(Android,adb,service)