我正在尝试从 adb shell 启动服务。已经有类似的问题:How to start and stop android service from 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>
你知道如何解决这个问题吗?谢谢!