4

As we all know by now, Android's Eclipse+ADT IDE framework doesn't support (re)using assets from a Library Project.

Instead, any asset resources used by an application must be stored in the assets/ directory of the application project itself.

My problem is that I have 8 (eight!) applications using the same Library Project that uses assets and as a result of the aforementioned limitation I have to copy/duplicate and sync each of the asset files to all 8 (eight!) applications.

This is a maintenance nightmare and it is error prone, too.

Any idea how to work around this by sharing a single copy of each asset among multiple application projects?

Note: I'd like to avoid an OS or filesystem dependent solution like hardlinks or softlinks. I prefer a solution like context.getAssets(), if it indeed does the work.

Community
  • 1
  • 1
Eternal Learner
  • 2,602
  • 5
  • 27
  • 38
  • 2
    `getAssets()` is a runtime solution, not a compile-time solution, and therefore would seem inappropriate for your situation, since it will not actually put the assets in each of the projects. Setting up the hardlink would have taken you less time than it took for you to write the question. Could you expand upon your note, so we can better understand what the issue really is with hardlinks and what you expect `getAssets()` to actually do for you? – CommonsWare Jul 24 '12 at 15:30
  • @CommonsWare You're right. `getAssets()` uses the same flawed assets mechanism that ignores all assets in Library Projects. I can't use hardlinks because the projects are on a shared server accessed by a variety of Windows, Mac and Linux desktops and laptops. Suggestions? – Eternal Learner Jul 24 '12 at 15:41
  • Put the hardlinks on the server. When the server is serving the files, the clients should be oblivious to the fact that the `asset/` directory is hardlinked. Or, figure out something tied into your version control system to enable sharing (e.g., git submodules). – CommonsWare Jul 24 '12 at 15:43
  • 1
    Try using **Eclipse Link Source**, see my answer [here](http://stackoverflow.com/questions/11340837/android-targeted-res-folders-for-debugging-in-eclipse/11370068#11370068) for details. It use res/ as an example, should works with assets/ as well. – yorkw Jul 24 '12 at 21:43

1 Answers1

0

Maybe things have changed since you posted the question, but I was able to reuse asset files from another project in my Android project. I created my project's assets folder as a linked folder. I posted a sample project to show how it works.

Don Kirkby
  • 53,582
  • 27
  • 205
  • 286