I read that article and tried to make subfolders in app/src/main/res/layout/
I think I did the whole things which are mentioned in that answer.
In my gradle:
apply plugin:
apply plugin:
apply plugin:
apply plugin:
android {
// something
sourceSets {
main {
res.srcDirs = getLayoutList("app/src/main/res/layout/")
}
}
def getLayoutList(path) {
File file = new File(path)
def throwAway = file.path.split("/")[0]
def newPath = file.path.substring(throwAway.length() + 1)
def array = file.list().collect {
"${newPath}/${it}"
}
def res="src/main/res";
array.push(res);
return array
}
dependencies { ... }
My directory hierarchy model (Project)
Test -- .gradle -- .idea -- app -- build -- libs -- src -- androidTest -- main -- assets -- java -- res -- layout -- about_login -- timetable -- activity_main.xml -- AndroidManifest.xml -- test -- build -- gradle -- .gitignore -- ... // Lot more setting files
But when I sync my gradle, the error came up and said, index error
def newPath = file.path.substring(throwAway.length() + 1)
at that line. Please help me.
Why this is different question?
1st. Many people works in their own PC but, I can't
2nd. I think that there has relationship between String.substring()
3rd. I cannot solve this problem.