On Fri, Mar 23, 2012 at 1:50 PM, Harshad <harshad...@gmail.com> wrote:

>
> From what I understand, in the newer SDKs, the Library project needs to be
> compilable by itself, while in earlier versions that was not necessary. In
> earlier versions, the source code from the library projects was merged with
> the final project and then compiled. Is that correct?

Library projects now (since ADT15?) produce a jar. Linked source
folders are now longer used, so there is no code merging.

>
> For example, if I have the following files:
> Free Project / A.java
> Pro Project / A.java
> Library Project / B.java                 // Refers to A.java
>

Don't refer to A.java directly. Put an abstract class or interface
in the library project, different implementations in the app projects,
etc.

> This used to work fine in earlier SDKs and allow me to keep common source
> code between free and Pro versions in the Library Project. But this isn't
> supported now. Is my understanding correct? If so, what are the best
> practices for handling such a scenario?
>
> One idea is: add a dummy A.java to the Library Project so that the library
> project compiles. I am hoping that the A.class from the Library Project will
> get overridden by the A.class from the dependent projects. Could there be
> problems with such an approach?

You will probably get errors when converting to dex because of the duplicate
classes.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to