Gray Mackall 6553713e4a
[CP-stable] Cherry pick "Fix flutter build aar for modules that use a plugin" (#154944)
Sum of changes is:
cherry pick of https://github.com/flutter/flutter/pull/154757
Merge
manual application of of https://github.com/flutter/flutter/pull/154945
manual application of https://github.com/flutter/flutter/pull/154967

Copied form below from automatic label (this is a cherry pick of https://github.com/flutter/flutter/pull/154757).

### Issue Link:
What is the link to the issue this cherry-pick is addressing?

Fixes https://github.com/flutter/flutter/issues/154371.

### Changelog Description:
Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples

Fixes a crash when building Flutter modules for android with `flutter build aar`, when using Android Gradle Plugin 8.0+.

### Impact Description:
What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)

Fixes the mentioned crash when building a module as an aar with Android Gradle Plugin 8.0+.

### Workaround:
Is there a workaround for this issue?

No.

### Risk:
What is the risk level of this cherry-pick?

### Test Coverage:
Are you confident that your fix is well-tested by automated tests?

### Validation Steps:
What are the steps to validate that this fix works?

Build a module:
1. `flutter create foobar --template=module`
2. `cd foobar`
3. Edit the `.android/build.gradle` to use AGP 8.1.
4. `flutter run`/`flutter build aar`
2024-09-11 16:55:50 +00:00
..
2024-06-17 19:39:12 +02:00
…

This directory contains tools and resources that the Flutter team uses during the development of the framework. The tools in this directory should not be necessary for developing Flutter applications, though of course, they may be interesting if you are curious.

The tests in this directory are run in the framework_tests_misc-* shards.