buildscript { repositories { google() mavenCentral() maven {url 'https://developer.huawei.com/repo/'} gradlePluginPortal() } dependencies { classpath 'com.android.tools.build:gradle:8.12.0' classpath 'com.huawei.agconnect:agcp:1.9.1.301' } } allprojects { repositories { google() mavenCentral() maven {url 'https://developer.huawei.com/repo/'} } } rootProject.buildDir = "../build" subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(":app") } // Temporary safeguard: set missing namespaces for Android library modules based on their manifest package subprojects { Project subproject -> subproject.pluginManager.withPlugin('com.android.library') { def androidExt = subproject.extensions.findByName('android') if (androidExt != null) { def hasNamespaceProp = androidExt.hasProperty('namespace') def currentNamespace = hasNamespaceProp ? androidExt.namespace : null if (hasNamespaceProp && !currentNamespace) { def manifestFile = file("${subproject.projectDir}/src/main/AndroidManifest.xml") if (manifestFile.exists()) { try { def manifest = new groovy.xml.XmlSlurper().parse(manifestFile) def manifestPackage = manifest.@package?.text() if (manifestPackage) { androidExt.namespace = manifestPackage subproject.logger.lifecycle("[namespace-fix] Set namespace for ${subproject.path} to '${manifestPackage}' from AndroidManifest.xml") } } catch (Throwable t) { subproject.logger.warn("[namespace-fix] Failed to read manifest for ${subproject.path}: ${t.message}") } } } } } } tasks.register("clean", Delete) { delete rootProject.buildDir }