From 1f1e9491cfe07ff089fa67dfaefde6a8d8d72b15 Mon Sep 17 00:00:00 2001 From: ali oliaee Date: Fri, 7 Mar 2025 17:31:06 +0330 Subject: [PATCH] feat: Add Android Gradle Plugin namespace support Adds a version check to conditionally set the namespace for Android builds using Gradle Plugin version 7.3.0 and above. --- android/build.gradle | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/android/build.gradle b/android/build.gradle index 336fd2cc..b2803c4f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -12,9 +12,25 @@ def safeExtGet(prop, fallback) { rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback } +def supportsNamespace() { + def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') + def major = parsed[0].toInteger() + def minor = parsed[1].toInteger() + + // Namespace support was added in 7.3.0 + if (major == 7 && minor >= 3) { + return true + } + + return major >= 8 +} + android { compileSdkVersion safeExtGet('compileSdkVersion', 29) buildToolsVersion safeExtGet('buildToolsVersion', "25.0.3") + if (supportsNamespace()) { + namespace "com.henninghall.date_picker" + } defaultConfig { minSdkVersion safeExtGet('minSdkVersion', 18)