Skip to content

Add2App: Fix crash resulted from hard-code module 'app' #27154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

kangwang1988
Copy link
Contributor

Currently, hard coded resource copy can't handle the case when developers use a Application module with name other than 'app'.
This will fix: #26948
Besides,
wiki: https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps
should be updated when this fix is finally landed if possible.

include ':example'
setBinding(new Binding([gradle: this, mainModuleName: 'example']))// new
evaluate(new File(                                                      // new
        settingsDir.parentFile,                                               // new
        'my_flutter/.android/include_flutter.groovy'                          // new
))// new

@kangwang1988 kangwang1988 added tool Affects the "flutter" command-line tool. See also t: labels. t: gradle "flutter build" and "flutter run" on Android customer: alibaba a: existing-apps Integration with existing apps via the add-to-app flow labels Jan 27, 2019
@jonahwilliams jonahwilliams merged commit 7c19ec6 into flutter:master Jan 30, 2019
kangwang1988 added a commit to XianyuTech/flutter that referenced this pull request Feb 12, 2019
@tarek360
Copy link

@kangwang1988
Thank you for this fix!
Are you going to update wiki?

@prczhb
Copy link

prczhb commented Aug 18, 2019

Currently, hard coded resource copy can't handle the case when developers use a Application module with name other than 'app'.
This will fix: #26948
Besides,
wiki: https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps
should be updated when this fix is finally landed if possible.

include ':example'
setBinding(new Binding([gradle: this, mainModuleName: 'example']))// new
evaluate(new File(                                                      // new
        settingsDir.parentFile,                                               // new
        'my_flutter/.android/include_flutter.groovy'                          // new
))// new

If I have multiple modules under one project, this still can't meet my needs. Only the last sentence (setBinding) will take effect.

include ':aaa'
include ':bbb'
include ':ccc'

setBinding(new Binding([gradle: this, mainModuleName: 'aaa']))// new
setBinding(new Binding([gradle: this, mainModuleName: 'bbb']))// new
setBinding(new Binding([gradle: this, mainModuleName: 'ccc']))// new

evaluate(new File(                                                      // new
         settingsDir.parentFile,                                               // new
         'my_flutter/.android/include_flutter.groovy'                          // new
 ))// new

Only the last sentence( ccc) takes effect
How can I configure these three modules?

如果我一个工程里有多个APP共用一个flutter lib ,我只能在 settings.gradle 配置一个APP去依赖flutter,如何才能让三个APP都能成功依赖那一个flutter

@kangwang1988 kangwang1988 deleted the alf_master_fix_hard_code_app_based_resource_copy_resulted_crash branch October 8, 2019 10:44
@xuyisheng
Copy link

It is changed back in the stable branch, very strange.

Project appProject = project.rootProject.findProject(':app') // Stable channel

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: existing-apps Integration with existing apps via the add-to-app flow customer: alibaba t: gradle "flutter build" and "flutter run" on Android tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add2App crashed in Android when the main Module is 'example' instead of 'app'
7 participants