Results 1 to 2 of 2
- 03-11-2014, 12:58 AM #1
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!
- 03-11-2014, 10:11 PM #2
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!
- By OSS in forum Jobs OfferedReplies: 0Last Post: 11-08-2012, 07:11 PM
- By Wolf_22 in forum New To JavaReplies: 0Last Post: 03-17-2011, 10:54 AM
- By bassfero in forum Advanced JavaReplies: 6Last Post: 09-30-2010, 07:38 PM
- By mnsse in forum New To JavaReplies: 8Last Post: 09-14-2009, 08:53 PM
- By bhupal4all in forum New To JavaReplies: 2Last Post: 09-05-2008, 09:58 AM