-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Allow flavors and custom build types in host app #36805
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
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception. Reviewers: Read the Tree Hygine page and make sure this patch meets those guidelines before LGTMing. /cc @dnfield |
|
@dnfield would it make sense for the bot to also check for |
9298404 to
c64368c
Compare
xster
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. Thanks!!
LGTM
| @Override | ||
| protected void onCreate(Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
| setContentView(Flutter.createView(this, getLifecycle(), "route1")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use the facade classes. Use https://github.com/flutter/flutter/wiki/Experimental:-Add-Flutter-Activity instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point on current fragment dependencies on the new embedding.
I think the easiest way to "exercise the engine and VM" which I think is the goal here is to just let MainActivity extend io.flutter.app.FlutterActivity instead of using the facade classes.
cc @matthew-carroll
dev/integration_tests/module_host_with_custom_build/app/build.gradle
Outdated
Show resolved
Hide resolved
dev/devicelab/bin/tasks/module_host_with_custom_build_test.dart
Outdated
Show resolved
Hide resolved
zanderso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm after addressing other reviewers' comments.
|
LGTM |
| if (packageAssets) { | ||
| String mainModuleName = "app" | ||
| try { | ||
| String tmpModuleName = project.rootProject.ext.mainModuleName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These days many many projects have a custom name for the app module, actually, many projects have multiple app modules.
So hardcoding the :app completely breaks many projects.
by removing this script, that makes this issue come back again.
We need a way to let developers set their app module name, or it will be better if you can detect it automatically in this script.
Please let me know if I can help!
Thank you!
@blasten @zanderso @xster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially, we could iterate through all the subprojects and find the one that applies the com.android.application plugin. Is this something you would like to explore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'd figure out that!
Description
In add2app scenarios, it is pretty common that the host app may have flavors or custom build types. However, when a Flutter module is added, you can't build the APK anymore. The Flutter project doesn't know about the parent project flavor when merging the assets. As a result you end up with a failure at build time. In the case of custom build types, if you build debug, then the debug APK doesn't have the snapshots since they are under the
assets/flutter_assetsdirectory.This PR reverts #22707 since I'm unable to reproduce issue #19818 in
masterafter reverting it.Related Issues
Fixes all these issues:
#30916
#34089
#36479
#29648
Tests
I added the following tests:
Integration test:
module_host_with_custom_build.dartChecklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?