Skip to content

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