In basic Java, if I write code to solve a common problem and want to use it in other projects, I would package it as a jar file and simply add it to those other projects.
But in Android–when that code may use drawables, strings and other resources–what can I do?
It looks like this question was asked here How to distribute the android reusable code in a package?, a year and a half ago, with the determination that hopefully this would be possible in the near future. I’m hoping someone has an update or a better answer.
The only option I know at the moment is to provide the full source and leave it to the using developer to move all classes into their project, add strings to their existing strings file, add their drawables to the project’s other drawables, etc. That is a nuisance and error-prone. Is there an easy way to add third-party code that contains these resources?
Apparently the only solution is to distribute the other code as an Android project, then to reference that other project in Eclipse. Of course, that makes versioning and collaboration more difficult–my guess is that a team would need to establish a naming convention for these third-party projects they use in their workspaces. Perhaps add a version number to the project name, so that one app can use a more recent version of the library without breaking apps using an older version?