Skip to content

Fix: Add namespace to build.gradle to resolve configuration error#38

Open
Musaddiq625 wants to merge 1 commit intoCodingDevs:mainfrom
Musaddiq625:patch-1
Open

Fix: Add namespace to build.gradle to resolve configuration error#38
Musaddiq625 wants to merge 1 commit intoCodingDevs:mainfrom
Musaddiq625:patch-1

Conversation

@Musaddiq625
Copy link

Fixed issue where the Android build would fail due to missing namespace definition

Fixed issue where the Android build would fail due to missing namespace definition
@Dhruvgera
Copy link

subprojects {
plugins.withId("com.android.library") {
val androidExtension = extensions.findByName("android") as? com.android.build.gradle.LibraryExtension
androidExtension?.let { android ->
if (android.namespace.isNullOrEmpty()) {
val manifestFile = file("src/main/AndroidManifest.xml")
if (manifestFile.exists()) {
val content = manifestFile.readText()
val regex = """package\s*=\s*"'["']""".toRegex()
val match = regex.find(content)
match?.groupValues?.get(1)?.let { packageName ->
android.namespace = packageName
}
}
}
}
}
}

can also use this as a workaround in build.gradle.kts if the package doesn't get this pr merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants