tags:

views:

58

answers:

2

Hi, i have two projects in Eclipse: service and UI client.

In onCreate in UI client I have:

startService(new Intent(this, ExampleService.class));

but this fragment:

ExampleService.class

throws NoClassDefFoundError exception at runtime. I have installed ExampleService.apk, and ExampleUiClient.apk. Project compiles, and everything looks fine. What I am doing wrong?

Is it possible to start service from other apk?

A: 

The service needs to be declared in the AndroidManifest.xml of your client.

Chris
AndroidManifest.xml from ExampleService.apk: <service android:name="com.domain.ExampleService" android:exported="true"></service>I added to AndroidManifest.xml from ExampleUiClient.apk <service android:name="com.domain.ExampleService" android:exported="true"></service> but it didn't help.Any other idea? I have similar problem previously with facebook sdk. There was facebook.apk, and I was unable to create instance of Facebook class in my project because of the same problem - it throws NoClassDefFoundError.
Piotr Wach
Is the apk also using the same package? May be try explicit names:new Intent("com.domain.mypackage", "com.domain.mypackage.MyService");
Chris
+1  A: 

Use a broadcast/broadcast receiver

Falmarri