我试图从adb
shell启动服务.已经有类似的问题:
How to start and stop android service from a adb shell?
但是,当我开始服务时:
但是,当我开始服务时:
adb shell am startservice com.mypackage/com.mypackage.service.MyService
我收到这个消息:
Starting service: Intent { act=android.intent.action.VIEW dat=com.mypackage/com.mypackage.service.MyService } Error: Not found; no service started.
我在AndroidManifest.xml中声明服务:
<application> ... <service android:name="com.mypackage.service.MyService" android:label="@string/local_service_label" android:icon="@drawable/ic_launcher"> </service> </application>
你有什么想法吗?
谢谢!
解决方法
adb shell am startservice -n com.mypackage/.service.MyService
-n添加’line_no:’前缀