Cherrio LLC
01/17/2023, 12:32 PMMatt Nelson
01/17/2023, 1:04 PMdarkmoon_uk
01/17/2023, 1:24 PMCherrio LLC
01/17/2023, 1:26 PMdarkmoon_uk
01/17/2023, 1:46 PMMatt Nelson
01/17/2023, 2:11 PM:app
module which is literally just the Application
and depends on all the shared modules (setup as android libs). Then use DI to inject the build info (which will have the variant name).
If you have a library with variants, you can do all you need in the :app
module by specifying what dependency should be used for what variant
// :app build.gradle.kts
android {
// setup variants Alpha Beta
}
dependencies {
"alphaImplementation"(project(":shared:lib-alpha"))
"betaImplementation"(project(":shared:lib-beta"))
}
eygraber
01/17/2023, 2:37 PMSebastian Sellmair [JB]
01/17/2023, 6:03 PMSebastian Sellmair [JB]
01/18/2023, 8:32 AMSebastian Sellmair [JB]
01/18/2023, 8:39 AMsourceSets.invokeWhenCreated("androidFreeDebug") {
}
darkmoon_uk
01/18/2023, 11:37 AMinvokeWhenCreated("androidSomeFlavor") { ... }
...proved to be a straightforward replacement for the...
val androidSomeFlavor by getting { ... }
...that we had before.
As you'll know better than me; before 1.8.0
, source sets were eagerly created from the Android model; so long as we took care to add the android {...}
block before the kotlin {...}
one, then by getting
would reliably succeed.
The creation eagerness change broke our build without giving us a clue why, and wasn't mentioned at all in the release notes as far as I know?
I really think the 1.8.0
/ Android Source-set v2 layout documentation deserves to be amended with a paragraph about migrating from the old initialisation order. We can't be the only ones to get tripped up by this.