Status Update
Comments
xa...@android.com <xa...@android.com> #2
dw...@gmail.com <dw...@gmail.com> #3
In the
So according to what #2 says, that is not possible yet. So that Issue should not be in the Released state, right?
I don't know if I'm missing something here, but if I'm wrong could you point me to some docs about this feature?
je...@google.com <je...@google.com> #4
zy...@google.com <zy...@google.com> #6
is...@gmail.com <is...@gmail.com> #7
[Deleted User] <[Deleted User]> #9
This would help design tools generate the files where the user wants them. If you have a small project, this keeps all the resources in a single folder for review in the system Files/Thumbnail view. Uses would have to resolve duplicate assets by specifying more of the path.
je...@google.com <je...@google.com>
im...@google.com <im...@google.com> #10
For example, you say you'd like to have:
- /absolute/path/to/app/src/main/res/drawable/group1/image1.png
- /absolute/path/to/app/src/main/res/drawable/group2/image2.png
- /absolute/path/to/app/src/main/res/drawable/image3.png
Instead of nesting the group under the resource folder, you can specify multiple source-sets:
- /absolute/path/to/group1/res/drawable/image1.png
- /absolute/path/to/group2/res/drawable/image2.png
- /absolute/path/to/app/src/main/res/drawable/image3.png (the original resource set)
Then in your build.gradle file you can add these new source sets to the current resource sets list:
android {
compileSdkVersion 28
sourceSets {
main {
res.srcDirs += [' /absolute/path/to/group1/res/', ' /absolute/path/to/group2/res/']
}
}
}
Would this solution work for you?
im...@google.com <im...@google.com> #11
sa...@gmail.com <sa...@gmail.com> #12
The current system is the developer analog of keeping all of your data files saved to the Desktop. For a few files, it's convenient and manageable but the moment you have any large or complex organization (and this is especially true for the same file name and type in different folders) it becomes unwieldy. Folder systems were created to address this problem in the first place.
Real-world example:
I'm making a solitaire game and I want to have more than one deck face. I should be able to have this
/deck1/Ace.png
/deck2/Ace.png
/deck3/Ace.png
Then, when loading resources, I only need to change the starting path to access the resource. Hardcoded it would be R.drawable.deck1.ace, R.drawable.deck2.ace...
Yes, I could keep them in separate system folders and add multiple srcDirs but, as
This isn't even to mention the incredibly long list under the drawable tree item in the Android view that, in my case, has a sub-folder for each card (e.g "Ace (2)" with two "Ace.png" entries underneath).
lu...@google.com <lu...@google.com>
lu...@google.com <lu...@google.com> #13
After an internal feasibility study on the feature, we have decided not to add resource folder sub-directories.
Many tools rely on the structure of the R class. This would be a very significant breaking change which would break 1st and 3rd party build tools. Changing the R class structure internal in AGP is a considerable amount of time and effort. Other potential implementations were also investigated, such as incorporating sub-directory names into resource names themselves, however this would lead issues such as resource name clashes. Allowing custom resource qualifies was also explored, but this makes project resource management more challenging. examining the feature request itself, resource sub-directories would likely encourage poor project structure such as not creating new project modules and instead creating monolithic modules; leading to worse build performance.
Ultimately, this issue is related to better organisation of related Android resources. If you feel the need to organise related resources in your project, it may be a sign to add a new library module with these resources. Project view search is also a powerful feature for navigating modules with many of a type of resource resources.
lb...@gmail.com <lb...@gmail.com> #14
@13 How should an SDK/module/library have files that whoever uses it - the files won't be overridden and won't be auto-suggested by the IDE when reaching R ? A layout XML file? A Drawable file? Even strings?
The more of these that you use, the more chance for it to happen and the more junk the IDE will offer to auto-suggest for you.
Description
I just tested the feature introduced in this issue (marked as released), but it's not working:
Problem:
I have a subfolder inside the "drawables" folder and the assets in that subfolder are not accessible via the R class.
I'm using Android Studio (beta) 0.8.14
Thanks