From 98375dcb6cc2a8f538d4de78ddf0b8cf2aeaac93 Mon Sep 17 00:00:00 2001 From: "balazsmanus@chameleon" Date: Tue, 25 Feb 2025 17:03:36 +0100 Subject: [PATCH] update build.gradle, so it may work with flutter plugins without namespaces --- refilc/android/app/build.gradle | 6 +++--- refilc/android/build.gradle | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/refilc/android/app/build.gradle b/refilc/android/app/build.gradle index 2af07fba..b45ab540 100644 --- a/refilc/android/app/build.gradle +++ b/refilc/android/app/build.gradle @@ -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 } } } diff --git a/refilc/android/build.gradle b/refilc/android/build.gradle index c375830f..5d338fed 100644 --- a/refilc/android/build.gradle +++ b/refilc/android/build.gradle @@ -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 {