I am trying to declare my android flavors in a separate gradle.kts file and then just apply them in my apps module gradle. But i keep getting Unresolved reference for “android”, “flavors” etc. etc. I tried to use the buildScripts folder for this, still no luck. How should this be done?
Don’t use legacy script plugins (the things you use with apply from).
They are bad practice by now.
Instead use convention plugins, for example implemented as precompiled script plugins.
Type-safe accessors like android { ... } you never get in legacy script plugins.
So you would need to use configure<TypeOfTheExtension> { ... } instead.
In precompiled script plugins you get the accessors for plugins you applied using the plugins { ... } block in the same script.
For plugins you applied in another plugin, you should use pluginManager.withPlugin(...) { ... } to make sure you only do the configuration after the plugin was actually applied and then again have to use configure... as no accessor will be present.
thanks for the reply @Vampire sorry but i am new to Kotlin DSL and didn’t exactly understood what you are trying to say i have tried configuring Extension in separate DSL file but i am not able to still access android block can you please provide some code or link that is useful and i can take reference from it?