我想從我的活動啓動服務,像這樣的時候:的ClassNotFoundException試圖從活動開始服務於Android的
startService(new Intent(MyActivity.this,
MyService.class));
有一個問題但是。什麼都沒發生。我在幕後進行調試,我可以看到BootClassLoader在ClassNotFoundException異常。我不知道這怎麼可能發生,因爲我得到了我的服務類在我的清單文件是這樣的:
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" android:enabled="true">
<service android:name=".MyService" android:exported="false"></service>
...
</application>
,它是在同一個包MyActivity。我在這裏有點堅果。可能是什麼問題?我調試到MyService但onCreate()
和onStartCommand()
也不會被調用。
感謝您解決了我的問題....以及我打電話adb卸載太多,只是爲了確保從我的機器人擦去車的代碼。 –