0

I used to have all my files in one folder of each type but recently I found an option do it in multiple (at least I think so) - orig. question stackoverflow

I tried to do it the way they did in the answer but there was a note on android site that you should avoid specifying a directory which is a parent to one. And so I did the following:

enter image description here

The code doesnt fail grandle sync but I am not sure if it works because even if I change the name of "mipmap" to something that isnt in the res folder it will sync anyways..

Is this the correct way of writing sourceSets for multiple folders of the same type?

  1. Should I add the srcDirs add to each directory in res folder meaning font/layout/menu/raw/values
  2. Is this the correct way of setting a source directory for mipmap which has multiple qualifiers?

Thanks for any help

EDIT : @MEETPrajapati This error popped in one of the drawable files once I synced it. error

Kristian
  • 165
  • 2
  • 16
  • if you have many product flavors then you should consider this. Otherwise, why make things so complicated? – Meet Prajapati Oct 16 '21 at 19:36
  • @MEETPrajapati my original 'Drawable' folder has more than 100 files now and it was getting a little hard to find the right file in it. Think this option might make it more clear – Kristian Oct 16 '21 at 19:43

1 Answers1

0

You can make a new drawable folder inside new res folder called "module1" like this :

    sourceSets{
    main {
        java.srcDir("src/main/java")
        res.setSrcDirs(["src/main/res","src/other/module1"])
        manifest.srcFile("src/main/AndroidManifest.xml")
    }
}
Meet Prajapati
  • 416
  • 5
  • 9