8

I would like to import into Assets folder an external directory, in which there are some files that I need to share across different platform distribution of the same app, basically Html files.

I've tried adding a Linked folder to android project from New-> Folder-> Advanced, using absolute or relative reference. But then

getAssets().open("folder")

Fails, with FileNotFound Exception.

I've tried also command line from assets folder:

ln -s ../../source_folder dest_folder

This creates a new "alias" folder into the filesystem, but Eclipse gets the folder not as a Linked resource but as a normal "Folder". I would go with this solution, but since we are a team of several developers sharing the same project, I believe the alias won't work on all systems, resulting that some files will be saved into the new "aliased" folder, others on the original folder.

In conclusion: is there anyone who came across the same problem? Is there a way, for a team, to reference an external folder as an Android asset?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
sosergio
  • 954
  • 2
  • 13
  • 25
  • I'd say put the files you need in the folder instead of using different content for each developer, but I guess there is a very good reason for that. – Warpzit May 21 '12 at 14:01
  • I think you need to ant you your way out of this, there is a similar post here: http://stackoverflow.com/questions/4793220/repackage-apk-file-to-contain-custom-assets-what-build-tool-to-use – Warpzit May 21 '12 at 14:09

1 Answers1

1

If you are using android studio, you can add your folder to assets folder, like following:

sourceSets {
    main {
        assets.srcDirs += 'your/folder'
    }
}

See here for detail:

ColdFire
  • 6,764
  • 6
  • 35
  • 51
xfdai
  • 2,735
  • 1
  • 19
  • 18