Skip to content

Commit cb5b892

Browse files
authored
feat: Add Android Gradle Plugin namespace support (#900)
Adds a version check to conditionally set the namespace for Android builds using Gradle Plugin version 7.3.0 and above.
1 parent 8313fd4 commit cb5b892

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

android/build.gradle

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,25 @@ def safeExtGet(prop, fallback) {
1212
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
1313
}
1414

15+
def supportsNamespace() {
16+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
17+
def major = parsed[0].toInteger()
18+
def minor = parsed[1].toInteger()
19+
20+
// Namespace support was added in 7.3.0
21+
if (major == 7 && minor >= 3) {
22+
return true
23+
}
24+
25+
return major >= 8
26+
}
27+
1528
android {
1629
compileSdkVersion safeExtGet('compileSdkVersion', 29)
1730
buildToolsVersion safeExtGet('buildToolsVersion', "25.0.3")
31+
if (supportsNamespace()) {
32+
namespace "com.henninghall.date_picker"
33+
}
1834

1935
defaultConfig {
2036
minSdkVersion safeExtGet('minSdkVersion', 18)

0 commit comments

Comments
 (0)