我正在尝试从 adb shell 启动该服务。已经有类似的问题了:如何从 adb shell 启动和停止 android 服务? https://stackoverflow.com/questions/7415997/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
更新(每adb shell am help start-service
):
-n
<COMPONENT_NAME>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)