update build.gradle, so it may work with flutter plugins without namespaces

This commit is contained in:
balazsmanus@chameleon
2025-02-25 17:03:36 +01:00
parent 8fd989dc62
commit 98375dcb6c
2 changed files with 17 additions and 3 deletions

View File

@@ -39,13 +39,13 @@ def debugKeystoreProperties = new Properties()
def debugKeystorePropertiesFile = rootProject.file("debugkey.properties")
debugKeystoreProperties.load(new FileInputStream(debugKeystorePropertiesFile))
// magical code that fixes builds
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (!hasProperty('namespace') || namespace == null || namespace.isEmpty()) {
// Assign a default namespace based on the project name or group
namespace = project.group.toString() ?: "com.example.${project.name}"
if (namespace == null) {
namespace project.group
}
}
}

View File

@@ -27,6 +27,20 @@ allprojects {
url "${project(':background_fetch').projectDir}/libs"
}
}
// magical code that fixes builds
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
}
subprojects {