0

I am working with IPC mechanism and handling it through bound service and using .adil file with custom object... i.e. my structure of adil fileis something like this :

Obj.aidl:

package com.example.demo.A;
parcelable Obj;

IMyService.aidl:

package com.example.demo.A;
import com.example.demo.A.Obj;

    interface IMyService {
        void requestSomething(in Obj data);
    }

enter image description here

And i am having three consumer applications to deal with this adil file and data which are bounded to this service... I have copied two aidl files(Obj and IMyService) and the DataModel class in all the three projects to make it work.

I am looking for the solution where I can re-use these code and make some common file so that i just need to import that file(something like jar file ) and i can work with aidl functions..

SweetWisher ツ
  • 7,296
  • 2
  • 30
  • 74

2 Answers2

1

I would suggest to setup an Android library project for this and put shared code in there. AIDL is supported too. This link might be helpful:

http://developer.android.com/tools/projects/projects-eclipse.html#SettingUpLibraryProject

sergej shafarenka
  • 20,071
  • 7
  • 67
  • 86
0

Eclipse Answer: You can entirely do what you suggest and export the project using export -> jar file.

In the JAR Export Dialog you need to exclude at least the AndroidManifest.xml as multiple such files will give Errors when you import the jar to another android project and try to build it.

The Manifest is not only in the main Project folder but also in the bin folder so exclude that too.

You may also exclude res, bin/classes/example/com/ and gen/com/example/ if you use no resources to get a smaller .jar.

The aidl files are inside bin/aidl. That of course needs to be included.

Also check the "Export Jave source files and resources" for better debugging.

FrankKrumnow
  • 501
  • 5
  • 13