2015-12-08 53 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命名複雜化,因爲我在包名中有服務?我沒有任何線索。