Commit 7c19ec6c authored by KyleWong's avatar KyleWong Committed by Jonah Williams

Add2App: Fix crash resulted from hard-code module 'app' based resource copy. (#27154)

parent 6d20ff24
......@@ -429,8 +429,16 @@ class FlutterPlugin implements Plugin<Project> {
}
if (packageAssets) {
String mainModuleName = "app"
try {
String tmpModuleName = project.rootProject.ext.mainModuleName
if (tmpModuleName != null && !tmpModuleName.empty) {
mainModuleName = tmpModuleName
}
} catch (Exception e) {
}
// Only include configurations that exist in parent project.
Task mergeAssets = project.tasks.findByPath(":app:merge${variant.name.capitalize()}Assets")
Task mergeAssets = project.tasks.findByPath(":${mainModuleName}:merge${variant.name.capitalize()}Assets")
if (mergeAssets) {
mergeAssets.dependsOn(copyFlutterAssetsTask)
}
......
......@@ -19,6 +19,12 @@ plugins.each { name, path ->
}
gradle.getGradle().projectsLoaded { g ->
g.rootProject.beforeEvaluate { p ->
_mainModuleName = binding.variables['mainModuleName']
if (_mainModuleName != null && !_mainModuleName.empty) {
p.ext.mainModuleName = _mainModuleName
}
}
g.rootProject.afterEvaluate { p ->
p.subprojects { sp ->
if (sp.name != 'flutter') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment