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?
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:
Android Studio: https://developer.android.com/studio/build/gradle-tips.html#change-default-source-set-configurations
Gradle: http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.api.AndroidSourceSet.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With