Add a way to supply Android manifest fragments from the Flutter SDK #152991
Labels
c: new feature
Nothing broken; request for a new capability
c: proposal
A detailed proposal for a change to Flutter
P2
Important issues not at the top of the work list
platform-android
Android applications specifically
team-android
Owned by Android platform team
tool
Affects the "flutter" command-line tool. See also t: labels.
triaged-android
Triaged by Android platform team
Uh oh!
There was an error while loading. Please reload this page.
Use case
Some features might require the addition of a section to the Android manifest file. This is the case for #139361.
The
flutter create
templates can be updated to add the required section to newly created projects, but this doesn't solve the problem for existing Flutter apps.Potentially this could be handled by writing migrations to update the
AndroidManifest.xml
source files in the app's tree, but (a) migrations are always tricky; (b) if for some reason a developer wanted to opt out of a given change, that approach doesn't offer a great answer for them. So this issue proposes a different solution.Proposal
Add a way for the Flutter SDK to supply one more Android manifest source file for the Android build process to merge together when it produces the manifest for the built app.
This is something Flutter plugins already routinely do. For Flutter itself, it'd probably involve adding an
AndroidManifest.xml
file somewhere in the framework tree underpackages/flutter_tools/
, like where the Gradle build scripts appear, and then having our Gradle build scripts include that file among the sources when building the app.For any element we add that a developer wants to opt out of, they can always tell the Android build process to leave it out by saying
tools:node="remove"
at a corresponding spot in their ownAndroidManifest.xml
source file.Once we have that mechanism:
<queries>
element added in [flutter_tools] - Addqueries
section to Android manifest file #137207. This would cause [Android] Respect custom system-wide text selection toolbar buttons #139361 to start working for existing Flutter apps, fixing a platform-fidelity issue.flutter create
template: the template puts<uses-permission android:name="android.permission.INTERNET"/>
in the filesandroid/app/src/{debug,profile}/AndroidManifest.xml
. Using the new mechanism, those would become redundant and the template could be simplified by removing them — so in fact both those files can be completely deleted from the template.AndroidManifest.xml
that would also be productive to move to this mechanism instead of theflutter create
templates. In general, this should be used for details that are determined by Flutter and just need to be in the manifest for the Flutter tool and engine to fully do their jobs; the templates should be used where we're just filling in a starting point for the developer to adjust from there.(Based on the discussion starting at #139361 (comment) .)
The text was updated successfully, but these errors were encountered: