Reputation: 12684
I have several applications that differ mostly based on resources. As of now, I'm copying the code around to each application. This can be problematic. An example, fixing a bug in one, and forgetting to update to the others.
I don't think creating a JAR is appropriate for this situation, as these are application specific UI classes, (actually android activity classes in specific) including the actual app start-up code.
It may be possible to include these source files into several packages, but then I have the problem that each file specifies a specific package name on the first line.
Most of the code is related to the UI and Activity processing. (The actual common code is already in a library). A similar question is posted here. Are there any elegant solutions to this situation?
Upvotes: 3
Views: 897
Reputation: 12684
I solved this by going with Android Library projects. (Not sure of the details, perhaps they are ultimately jars) Check out details here, specifically the section 'Setting up a Library Project'. I basically put in all my activity classes (except for the start-up one) into the library.
For true non-UI bound code, JARs, do seem to be the way to go.
Upvotes: 2
Reputation: 38152
I agree with artbristol.
I also recommend to use Maven and:
Like this you don't break applications if you do some incompatible changes.
Upvotes: 1
Reputation: 32437
A jar is absolutely appropriate for this situation. You should split your application into layers, separating the application-specific classes from the shared code.
Upvotes: 6