Unable to start Service Intent Unable to start Service Intent android android

Unable to start Service Intent


For anyone else coming across this thread I had this issue and was pulling my hair out.I had the service declaration OUTSIDE of the '< application>' end tag DUH!

RIGHT:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"  ...>...<application android:icon="@drawable/icon" android:label="@string/app_name">    <activity ...>        ...    </activity>        <service android:name=".Service"/>    <receiver android:name=".Receiver">        <intent-filter>            ...        </intent-filter>    </receiver>        </application><uses-permission android:name="..." />

WRONG but still compiles without errors:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"  ...>...<application android:icon="@drawable/icon" android:label="@string/app_name">    <activity ...>        ...    </activity></application>    <service android:name=".Service"/>    <receiver android:name=".Receiver">        <intent-filter>            ...        </intent-filter>    </receiver>        <uses-permission android:name="..." />


First, you do not need android:process=":remote", so please remove it, since all it will do is take up extra RAM for no benefit.

Second, since the <service> element contains an action string, use it:

public void onCreate(Bundle savedInstanceState) {          super.onCreate(savedInstanceState);        Intent intent=new Intent("com.sample.service.serviceClass");        this.startService(intent);}


1) check if service declaration in manifest is nested in application tag

<application>    <service android:name="" /></application>

2) check if your service.java is in the same package or diff package as the activity

<application>    <!-- service.java exists in diff package -->    <service android:name="com.package.helper.service" /> </application>
<application>    <!-- service.java exists in same package -->    <service android:name=".service" /> </application>