Why can't a .aidl be placed into a library project?
Asked Answered
B

1

6

I came across a comment this answer which states that a library project:

  1. cannot hold .aidl files,
  2. cannot depend on another library project,
  3. cannot hold assets

Well, that comment was made about a year and a half ago, and I can tell you with utmost certainty that item #2 is no longer true (September 2010?), because I have a perfectly working project, made of a library project that depends on another library project.

So, my questions are two:

  1. Is it still true that a library project cannot hold .aidl files?
  2. If the answer to #1 is yes, then what is the reason for this?

BTW, as an experiment, I tried to place IMarketBillingService.aidl (from the In-app Billing sample) in a library project (without anything that uses it yet), and the project builds and runs as before. So, if it's still isn't possible for a library project to contain a .aidl, this must be something deeper...

Berdichev answered 13/1, 2012 at 2:8 Comment(0)
L
6

The answer is 'No'. You can use an AIDL file in library projects just fine. I use such a setup in three different projects. Don't remember exactly when, but they fixed this a while ago (probably when they added the library-library support to ADT). The reason it didn't work before is that the ADT builder didn't recognize the AIDL file and didn't generate the necessary Java stubs.

Lemmie answered 13/1, 2012 at 3:12 Comment(3)
Thanks! It turns out that another limitation has been recently removed: Generate a library project into its own JAR file. Note that the documentation on the same page contradicts itself, but I just tested this new feature and you can generate a JAR from a library project independently, without depending on an application project.Berdichev
Yes, you can generate a JAR. However, the jar doesn't contain any resources, so if you have layouts, strings, etc in the library project, you can't just drop the jar in your app project. Follow the ADT site directly for most up-to-date info, the documentation is sometimes outdated. sites.google.com/a/android.com/tools/recentLemmie
Another +1 for the link to sites.google.com/a/android.com/tools/recent - I didn't know about that page. This is very useful. Thanks!Berdichev

© 2022 - 2024 — McMap. All rights reserved.