Skip to content

Commit d2412ba

Browse files
committed
update gradle to ignore namespace requirement
1 parent 5104142 commit d2412ba

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

android/build.gradle

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,30 @@ rootProject.buildDir = '../build'
99
subprojects {
1010
project.buildDir = "${rootProject.buildDir}/${project.name}"
1111
}
12-
subprojects {
12+
subprojects { subproj ->
1313
project.evaluationDependsOn(':app')
14+
afterEvaluate {
15+
if (subproj.plugins.hasPlugin("com.android.library")) {
16+
def androidExt = subproj.extensions.findByName("android")
17+
if (androidExt && !androidExt.hasProperty("namespace")) {
18+
def manifestFile = file("${subproj.projectDir}/src/main/AndroidManifest.xml")
19+
if (manifestFile.exists()) {
20+
// read package="..." from manifest
21+
def pkg = null
22+
manifestFile.withInputStream { is ->
23+
def xml = new XmlSlurper(false, false).parse(is)
24+
pkg = xml.@package?.text()
25+
}
26+
if (pkg) {
27+
androidExt.namespace = pkg
28+
println("Set namespace for ${subproj.path} -> ${pkg}")
29+
} else {
30+
throw new GradleException("No package found in ${manifestFile} for ${subproj.path}. Please upgrade the dependency or set a namespace.")
31+
}
32+
}
33+
}
34+
}
35+
}
1436
}
1537

1638
tasks.register("clean", Delete) {

pubspec.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ packages:
8282
source: hosted
8383
version: "1.1.2"
8484
collection:
85-
dependency: transitive
85+
dependency: "direct main"
8686
description:
8787
name: collection
8888
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
@@ -226,7 +226,7 @@ packages:
226226
source: hosted
227227
version: "0.6.0"
228228
firebase_core:
229-
dependency: transitive
229+
dependency: "direct main"
230230
description:
231231
name: firebase_core
232232
sha256: "6b343e6f7b72a4f32d7ce8df8c9a28d8f54b4ac20d7c6500f3e8b3969afca457"
@@ -374,7 +374,7 @@ packages:
374374
source: hosted
375375
version: "1.5.0"
376376
http_parser:
377-
dependency: transitive
377+
dependency: "direct main"
378378
description:
379379
name: http_parser
380380
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
@@ -454,7 +454,7 @@ packages:
454454
source: hosted
455455
version: "0.2.2"
456456
intl:
457-
dependency: transitive
457+
dependency: "direct main"
458458
description:
459459
name: intl
460460
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
@@ -534,7 +534,7 @@ packages:
534534
source: hosted
535535
version: "1.3.0"
536536
markdown:
537-
dependency: transitive
537+
dependency: "direct main"
538538
description:
539539
name: markdown
540540
sha256: "935e23e1ff3bc02d390bad4d4be001208ee92cc217cb5b5a6c19bc14aaa318c1"

0 commit comments

Comments
 (0)