Why can I use another Android project as library project without setting is as a library project?

StackOverflow https://stackoverflow.com/questions/14968389

  •  10-03-2022
  •  | 
  •  

Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top