3

I am having a jar file which contains some service classes. The jar's are placed in frameworks of Android. I want to bind to that service in an application. Currently I am using this:

 Intent intent = new Intent(IMyAidl.class.getName());
 boolean returnvalue = mContxt.bindService(intent,connection, Context.BIND_AUTO_CREATE);
 System.out.println("Binding to service in jar are not " + returnvalue);

When I am using the above code I couldn't bind at all. Every time false is the returned value. I am not understanding why it is returning false.

Can anybody help on this?

Satya
  • 800
  • 7
  • 20

1 Answers1

1

The most probable problem you have is that your build script is not configured well. You should have a pre-build step that copies the class files to the directory that converts them into dex format.

Another common mistake that I've seen is forgetting to include the service declaration in the manifest file if the application. If that doesn't work please include more details about the app.

Zvi
  • 237
  • 3
  • 8
  • The way I have done is: Placed the services which are present in the jar files in manifest file of application. But i didnt understand how link will be provided between my application and jar?? Should I configure by some how? – Satya Aug 18 '12 at 12:03
  • Have you looked at [this post?](http://stackoverflow.com/questions/1334802/how-can-i-use-external-jars-in-an-android-project) – Zvi Aug 18 '12 at 12:06
  • Yes I have looked but I am not porting my application in android source code... If I am writing through eclipse it is working but i need to write the application such that it is built in one\ – Satya Aug 18 '12 at 12:21