Ben Ben - 1 year ago 72
Android Question

Android ActivityNotFoundException despite everything being correct in Eclipse

I created this simplest possible service project (based on this) in Eclipse 3.8 with the most up to date Android Tools and posted it here:

I get the following error when I start it:

02-03 00:18:45.984: E/AndroidRuntime(20145): java.lang.RuntimeException:
Unable to start activity ComponentInfo{net.softmann/net.softmann.HelloActivity}:
Unable to find explicit activity class {net.softmann/net.softmann.HelloService};
have you declared this activity in your AndroidManifest.xml?

But it is in my manifest!! What am I doing wrong? I have also tried using "net.softmann.HelloService" instead of ".HelloService" and still no luck.

Answer Source

The exception says you're trying to start an activity net.softmann/net.softmann.HelloService and it is not found.

Looking at your manifest file, you have a service with such name.

Looking at your activity code, you have

startActivity(new Intent(getApplicationContext(), HelloService.class));

Start services with startService() and not startActivity().

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download