2015-12-08 54 views
1

我想从另一个应用程序启动服务。Android全球服务

logcat的错误是:

Unable to start service Intent { cmp=com.oic.launchertest.service/.DataSyncService } U=0: not found 

从App与服务

<service 
    android:name="com.oic.launchertest.service.DataSyncService" 
    android:enabled="true" 
    android:exported="true"> 
</service> 

在其他应用清单我想用下面的代码

Intent intent=new Intent(); 
intent.setComponent(new ComponentName("com.oic.launchertest.service", "com.oic.launchertest.service.DataSyncService")); 
startService(intent); 

推出的服务我可能需要一些建议,可能会导致这个问题。

在此先感谢。

+0

[THIS]的副本(http://stackoverflow.com/questions/19105587/unable-to-start-service-intent-not-found)和[THIS](http://stackoverflow.com/questions/ 8359786/android-unable-to-start-service-intent-not-found) –

+0

@DevendraSingh这两个线程在我的情况下都没有帮助 – broesel001

+0

删除服务并重新创建一个新服务。或重新开始工作室。 –

回答

0

我确实用下面的解决方案解决了这个问题。我在评论中阅读了此内容,但无法找到该线程...

更改服务的位置确实有帮助。

我改变了它从

com.oic.launchertest.service.DataSyncService 

com.oic.launchertest.launcher.DataSyncService 

和服务现在被发现。也许这是一些Android命名复杂化,因为我在包名中有服务?我没有任何线索。