0

Ok I know how to set an Android project as a library project and adding it to another Android project as a library reference.

However after I did this, I removed the checkmark "Is library", so the first project wasn't a library project and could be run as a normal Android project.

The second project referencing the first project is also working nicely and I can change the first project and still use it directly in the second project.

So why the big fuss with setting a project as a library, when I can remove the checkmark afterwards and the reference is still working? I don't get that - can anyone explain this?

I'm using Eclipse 3.7 (Indigo) together with the ADT plugin version 21.

Darwind
  • 7,284
  • 3
  • 49
  • 48

1 Answers1

3

So why the big fuss with setting a project as a library, when I can remove the checkmark afterwards and the reference is still working? I don't get that - can anyone explain this?

A general rule among programmers is "be liberal in accepting input and be conservative in generating output". In this case, the build system is being liberal and is using your first project as a library despite it not presently being marked as a library.

However:

  • You cannot set up the initial host->library relationship without "Is Library" checked in Eclipse

  • You may not be able to set up the initial host->library relationship via android update lib-project without the equivalent setting in project.properties (it might work -- I just haven't tried it)

  • You should not assume that the liberal interpretation of the input will be reliable over the long haul, as future versions of the tools may have need to check that flag and enforce its setting

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks for the concise answer - this makes sense. ;-) I have 2 projects where the second one is build directly on the first one, except for the images and colors. The first project is also on Google Play so it's really great that I can keep using both projects, but I'll take this into account in the future, that it might stop working. As for now I'll keep it like this, so I don't need to create another project for the first app to extend the first project. – Darwind Feb 21 '13 at 20:04