1

I need to maintain some duplication into my Android App (in Android Studio) by having some resources in "res/values-iw/" and copy the exact content of that folder to a folder named "res/values-he/". The reason is explained here.

I saw that gradle has a copy function but I have no idea with what task it would be better to wire it (and I guess as doFirst)?

Also, is it possible to not have that copied folder in my original res folder as I don't really need to see it all the time beside the original one, for instance in /build/ folder for build time? That way the copied folder will always be an up-to-date copy of the original "/res/values-iw" folder.

Thanks in advance, Alex

Community
  • 1
  • 1
galex
  • 3,279
  • 2
  • 34
  • 46

2 Answers2

2

Instead of copying, you might want to set up symlinks instead. The symlinks should hopefully be preserved in source control, and it's better than having the build system muck around with duplicating source files. For large resources, though, like drawables, consider using aliases which should hopefully prevent duplication that will bloat your APK.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
  • As mentioned at this link (http://stackoverflow.com/questions/954560/what-does-git-do-to-files-that-are-a-symbolic-link) symlinks content is not in the repository and are it is indeed the symlink itself that will be in the repository. Good solution! – galex Jan 16 '14 at 15:18
1

Instead of copying, would alias resources be better? http://developer.android.com/guide/topics/resources/providing-resources.html#AliasResources

They let you create references to a single resource in different contexts instead of copying them around. It should save space in your binary, too, which would be a big plus.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
  • The idea is not bad however it means that I still have to maintain that alias resource folder, one by one, and be sure that I'll add an alias for every new element added in the 'source' folder. Can we alias a complete res folder? – galex Dec 11 '13 at 16:08
  • You have to alias resources individually, and the technique doesn't work with all resource types. – Scott Barta Dec 11 '13 at 17:26