1

Currently I use a remote service in an android project. I defined the interface in two aidl files which are stored in the /src folder of my service project.

Now I have another project which binds to the service. For that I must, however, put the aidl files from my service in the /src folder of my application project.

This act is described here.

Now I have the the same aidl files two times. Imagine I have 100 client applications each in its own project. Now if I want to change something in the aidl file, I have to consider each copy of them which is not really nice...

Is there a way to centralize the aidl files?

BananaJoe
  • 45
  • 7
  • In Eclipse you can put the AIDL in a 'linked source' folder which is referred to by both projects. – NickT Mar 12 '14 at 17:34
  • For more detailed explanation, see my answer to http://stackoverflow.com/questions/4656689/aidl-interface-between-two-applications/4657649#4657649 – NickT Mar 12 '14 at 18:25
  • Thank you! I've created a new library project with only the aidl files and linked the other projects to it. Everything works fine. – BananaJoe Mar 13 '14 at 12:17
  • @NickT, please, add your comment as a reply to the question and user3394244, please, accept it. – Yury Apr 01 '14 at 10:54

1 Answers1

2

You can create a sdk project which contains your all aidl files and that sdk project can be included in all applications where you want to use.

sdk project can be created by changing code in build.gradle file from:

apply plugin: 'com.android.application'

to:

apply plugin: 'com.android.library'

Now you can include all your *.aidl files under any folder as shown in file hierarchy in image below:

enter image description here

After creating this sdk project simply add this project in your other project by just adding following code in settings.gradle :

include ':sdk'
project(':sdk').projectDir = new File("../**location of sdk**")

Hope this helps.

Harneev
  • 544
  • 4
  • 12