Skip to content

Conversation

@blasten
Copy link

@blasten blasten commented Jan 12, 2021

Fixes #72185.

I think this change will cause an issue if flavors are used. Unfortunately, if that's the case, we will have no choice, but to remove the support.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels. labels Jan 12, 2021
@google-cla google-cla bot added the cla: yes label Jan 12, 2021
@flutter flutter deleted a comment from flutter-dashboard bot Jan 12, 2021
{
"name": "Linux gradle_desugar_classes_test",
"repo": "flutter",
"task_name": "linux_gradle_desugar_classes_test",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes if this is a new tasks then the builders should exist before adding these configurations. My recommendation is to land the code changes then create the configs in infra and the final step would be updating the prod|try_builders.json.

We just added some docs: https://g3doc.corp.google.com/company/teams/flutter/luci/builders.md?cl=head

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

// Not doing so, causes transitive dependency resolution conflicts.
// That is, the embedding dependencies resolved in the plugin are
// different than the ones resolved in the app.
if (isGradleVersionGraterOrEqualThan('6.0.0')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: just noticed this but that method should be Greater, not Grater.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh. I removed this method as it's no longer used.

@dnfield
Copy link
Contributor

dnfield commented Jan 12, 2021

You are right that this has broken flavors.

I'm fairly certain that there are people using this. I'm not sure I grasp the full scope of the problem here - I suspect it's some confluence of flavors being something hacky that was never fully baked/thought through/owned and gradle madness.

/cc @xster for thoughts about killing support for flavors on Android. It might also be worth consulting with the Gradle/AGP team to see if there's some way we can still make this worth.

@xster
Copy link
Member

xster commented Jan 12, 2021

I don't think we added specific analytics but based on github issues, flavors and build configs on iOS are definitely used. Can you describe the root issue a bit and how this solution was chosen?

@blasten
Copy link
Author

blasten commented Jan 12, 2021

I left a comment in the Gradle script. Basically, after https://issuetracker.google.com/139821726, AGP has a new optimization that configures the build such as Java 8+ APIs are desugared if an explicit API dependency is set on such code. Here the API is the Android embedding, which is used by a plugin.

When two Gradle projects have the same API dependency, you get duplicated symbols https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket.appspot.com/8858351162389675568/+/steps/run_gradle_plugin_light_apk_test/0/stdout?format=raw

I will ask the AGP team to confirm that my understanding is correct.

@blasten blasten requested a review from dnfield January 13, 2021 02:23
@blasten
Copy link
Author

blasten commented Jan 13, 2021

Alright. The good news is that I was able to fix the issue following a suggestion from the AGP team.

The new solution is: If an app has plugin, the app doesn't depend on the embedding directly. Instead, the app sets an API dependency on the plugins, and the plugins set an API dependency on the embedding. Let me know if that makes sense.

ptal

@dnfield
Copy link
Contributor

dnfield commented Jan 13, 2021

Will that work out ok if there are multiple plugins?

@blasten
Copy link
Author

blasten commented Jan 13, 2021

Yes, it will

}
// The embedding is set as an API dependency in a Flutter plugin.
// Therefore, don't make the app project depend on the embedding if there are Flutter
// plugins since it causes duplicated classes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe mention the interplay with the flavors implementation here.

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@blasten blasten deleted the fix_plugin_class_desugar branch January 14, 2021 00:32
@reidbaker reidbaker mentioned this pull request Jun 24, 2025
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[google_maps_flutter] fatal exception and crash on Android: java.lang.AbstractMethodError

5 participants