I have 2 android applications that share 95% of their resources, layouts, strings etc. only a few jpg's are different.
How can I share resources between the different Eclipse Android projects, so as to avoid开发者_运维技巧 resource duplication ?
Eclipse provides 2 ways to do it,
- Create a library project and include this library projects in two application projects
- Create a Shared Source Folder, goto your project properties and in Source tab, you can link a folder which may be in any other project and include all files of those folder as a link, without duplicating them.
I was having trouble figuring this out as well, and these answers didn't provide enough info for me to get code shared across projects (I'm running Eclipse Indigo SR2), so here's what I did:
Create a Java Project to consume the shared resources, say SharedConsumer
Create a Java Project that contains the shared resources, say SharedResources
Open Project Properties for SharedConsumer
, navigate to Java Build Path, Projects tab
Click Add... and select SharedResources
.
Resources within SharedResources
are now all accessible to SharedConsumer
as if they were within SharedConsumer
.
Put all your common resources into a separate jar and use this in your separate projects.
精彩评论