buildscript { ext.kotlin_version = '1.9.22' repositories { google() mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { google() mavenCentral() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } tasks.register("clean", Delete) { delete rootProject.buildDir } subprojects { afterEvaluate { project -> if (project.hasProperty('android')) { def androidExt = project.extensions.findByName('android') if (androidExt != null && androidExt.hasProperty('namespace') && (androidExt.namespace == null || androidExt.namespace == '')) { def manifestFile = project.file('src/main/AndroidManifest.xml') if (manifestFile.exists()) { def manifestText = manifestFile.text def matcher = manifestText =~ /package="([^"]+)"/ if (matcher.find()) { androidExt.namespace = matcher.group(1) } } } } } }