Skip to content

Commit b45e958

Browse files
fix: add workaround to avoid gradle issues related to twitter_login
Reference: - 0maru/twitter_login#140
1 parent 7ce1f04 commit b45e958

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

flutter_news_example/android/build.gradle.kts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,24 @@ subprojects {
1919
project.evaluationDependsOn(":app")
2020
}
2121

22+
// Temporary workaround for third-party Android modules that still do not set
23+
// an explicit namespace. Remove once upstream dependencies are updated.
24+
// https://github.com/0maru/twitter_login/issues/140
25+
subprojects {
26+
pluginManager.withPlugin("com.android.library") {
27+
val androidExtension = extensions.findByName("android") ?: return@withPlugin
28+
val androidClass = androidExtension.javaClass
29+
val getNamespace = runCatching { androidClass.getMethod("getNamespace") }.getOrNull() ?: return@withPlugin
30+
val setNamespace =
31+
runCatching { androidClass.getMethod("setNamespace", String::class.java) }.getOrNull() ?: return@withPlugin
32+
33+
val namespace = getNamespace.invoke(androidExtension) as? String
34+
if (namespace.isNullOrBlank()) {
35+
setNamespace.invoke(androidExtension, project.group.toString())
36+
}
37+
}
38+
}
39+
2240
tasks.register<Delete>("clean") {
2341
delete(rootProject.layout.buildDirectory)
2442
}

0 commit comments

Comments
 (0)