I use the build.gradle file to collect several folders on my computer in my app's asset folder:
sourceSets {
main {
assets.srcDirs = ['../someFolder/', 'src/main/assets']
}
}
This leads to my asset folder having the files of someFolder
and the "original" asset folder:
//The "physical" folders
../someFolder
|- file1.txt
|- file2.txt
|- file3.txt
src/main/assets
|- asset1.txt
//...become this:
assets
|- file1.txt
|- file2.txt
|- file3.txt
|- asset1.txt
How can I redirect the paths in gradle so that my asset folder contains a folder "someFolder" with all the files from someFolder
, e.g:
assets
|- someFolder
|--- file1.txt
|--- file2.txt
|--- file3.txt
|- asset1.txt
To change its path go to this path File > Settings... > Build, Execution, Deployment > Gradle In the Global Gradle settings Change Service directory path to what you want.
gradle file, located in the root project directory, defines dependencies that apply to all modules in your project. By default, the top-level build file uses the plugins block to define the Gradle dependencies that are common to all modules in the project.
1) Create folder inside of the project as your external assets ./extAssets
sourceSets.main.assets.srcDirs = ['src/main/assets', './extAssets']
2) Link all your external directories inside this folder
$ cd extAssets/
$ ln -s ../../someFolder/ someFolder
As result you will see
assets
|- someFolder
|--- file1.txt
|--- file2.txt
|--- file3.txt
|- asset1.txt
without any file copying
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