开发者

How can I share resources between the different Eclipse projects, so as to avoid duplication?

开发者 https://www.devze.com 2023-01-08 20:21 出处:网络
I have 2 android applications that share 95% of their resources, layouts, strings etc. only a few jpg\'s are different.

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,

  1. Create a library project and include this library projects in two application projects
  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消