Results 1 to 2 of 2
  1. #1
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Multiple versions of android-support-v4

    Background: If you create an Android project where the target SDK version differs from the minimum SDK version (I think these are the relevant values, not completely sure) the project will automatically include a library called android-support-v4. All is well if a project and its dependency tree contain multiple copies of the same version of android-support-v4. But if the dependency tree contains two or more different versions, it will not build.

    SO was uncharacteristically un-helpful with this. The solutions there include removing android-support-v4 from all your projects and making them all depend on a library project whose sole purpose is to contain android-support-v4. Another option is to keep manually updating all your projects with the latest android-support-v4.

    It seems evident to me that in general, library projects should not contain android-support-v4 at all. Only applications should contain it. But the question then becomes, what should the min/max/target SDK settings on a library project be so that it can be built without android-support-v4 in its own dependency tree, while also being maximally compatible with other projects?

    Currently trying to grok this and this...
    Get in the habit of using standard Java naming conventions!

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Multiple versions of android-support-v4

    Okay, this is what I think I know. If anyone finds this thread while looking for answers, take this with a grain of salt.

    If your library doesn't actually use the support library (and I don't know why it would) you can simply delete it from the project. If you're using Eclipse, it will freak out and you'll have to shut down and restart it before it will straighten itself out. Or maybe you can get away with just closing and reopening the project. I think I was right that in general, libraries should not contain the support library.

    To maximize its usefulness, your library's minimum SDK version should be set to the minimum actually required to build it. Or maybe it should be set to a later version if there was a SDK version that contained some quirk that would affect your library and that you haven't bothered to work around. (I'm lookin' at you, AsyncTask order of execution flip-flop...) You could use the max SDK version for similar reasons.

    I don't know if the target SDK version matters for libraries. I guess you should set it to the highest version you've tested on, as you do for applications.

    There was one idea on SO that I think might be good: create a library project whose sole purpose is to export android-support-v4. Make all your application projects depend on that project. Then you can easily update your support lib to the latest version.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Replies: 0
    Last Post: 11-08-2012, 08:11 PM
  2. Replies: 0
    Last Post: 03-17-2011, 11:54 AM
  3. Multiple-mouse support
    By bassfero in forum Advanced Java
    Replies: 6
    Last Post: 09-30-2010, 08:38 PM
  4. Different versions of Jar
    By mnsse in forum New To Java
    Replies: 8
    Last Post: 09-14-2009, 09:53 PM
  5. How to support multiple languages?
    By bhupal4all in forum New To Java
    Replies: 2
    Last Post: 09-05-2008, 10:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •