Issue
I understand that Android Studio does not support subdirectories as specified in Can the Android drawable directory contain subdirectories?.
My question is, what is the standard way to handle this problem when working with a lot of assets? My general workflow would benefit greatly if I was able to see similar assets in one directory separate from other assets.
An example: Instead of having
drawable
- a_asset_01
- a_asset_02
- a_asset_03
- b_asset_01
- b_asset_02
- b_asset_03
Maybe I can have somethinging "similar" to
drawable
- a_assets
-- a_asset_01
-- a_asset_02
-- a_asset_03
- b_assets
-- b_asset_01
-- b_asset_02
-- b_asset_03
Again, I understand that this cannot be done in Android Studio, I'm simply looking for the next best thing.
Solution
You can specify new source-sets! You can have separate folders wherever you want, for example you can have ~/my_assets/A/assets
, ~/my_assets/B/assets
and ~/my_assets/C/assets
. All you need to do is tell Gradle where to find them by adding them to the assets
source sets in your build.gradle
file:
android {
compileSdkVersion 28
sourceSets {
main {
assets.srcDirs += ['/full/path/to/my_assets/A/assets/', 'full/path/to/my_assets/B/assets/', 'full/path/to/my_assets/C/assets']
}
}
}
Answered By - Izabela Orlowska
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.