Steps to reproduce
- Create a fresh Flutter app and add a dependency that touches
flutter_gpu on the first frame (e.g. flutter_scene). Any access to gpu.gpuContext triggers the runtime check.
- Connect an Android device with Vulkan-Impeller support (reproduced on Pixel 10 Pro, Android 16 / API 36).
- Run with the documented opt-in flag, without adding any manifest metadata:
flutter run -d <android-device> --enable-flutter-gpu --enable-impeller
Expected results
The app launches with Flutter GPU enabled, matching the runtime error message which lists --enable-flutter-gpu as a valid way to opt in (engine/src/flutter/lib/gpu/context.cc:53–58):
Flutter GPU must be enabled via the Flutter GPU manifest setting. This can be done either via command line argument --enable-flutter-gpu or by adding the FLTEnableFlutterGPU key set to true in the Info.plist on iOS/macOS, or the io.flutter.embedding.android.EnableFlutterGPU metadata key to true in the AndroidManifest.xml on Android.
…and matching the documented behavior on iOS/macOS where the CLI flag alone is sufficient.
Actual results
The app throws:
Exception: Flutter GPU must be enabled via the Flutter GPU manifest setting. This can be done
either via command line argument --enable-flutter-gpu or by adding the FLTEnableFlutterGPU
key set to true in the Info.plist on iOS/macOS, or the
io.flutter.embedding.android.EnableFlutterGPU metadata key to true in the AndroidManifest.xml
on Android.
repeatedly on every frame, because dart_state->IsFlutterGPUEnabled() returns false (engine/src/flutter/lib/gpu/context.cc:51).
Adding the manifest opt-in to android/app/src/main/AndroidManifest.xml works around it:
<meta-data
android:name="io.flutter.embedding.android.EnableFlutterGPU"
android:value="true" />
Test matrix
Same minimal app, no FLTEnableFlutterGPU in Info.plist, no EnableFlutterGPU in AndroidManifest.xml unless noted.
| Platform |
CLI flag |
Manifest/plist key |
Result |
| macOS |
--enable-flutter-gpu |
none |
✅ Flutter GPU enabled |
| macOS |
(none) |
none |
❌ Runtime exception (expected) |
| iOS |
--enable-flutter-gpu |
none |
✅ Flutter GPU enabled |
| iOS |
(none) |
none |
❌ Runtime exception (expected) |
| Android |
--enable-flutter-gpu |
none |
❌ Runtime exception (bug) |
| Android |
(none) |
EnableFlutterGPU=true |
✅ Flutter GPU enabled |
| Android |
--enable-flutter-gpu |
EnableFlutterGPU=true |
✅ Flutter GPU enabled |
So the CLI flag enables the API on iOS and macOS but not Android.
Where it diverges
- iOS:
FlutterDartProject.mm:226–228 reads the Info.plist key. The --enable-flutter-gpu switch also reaches settings.enable_flutter_gpu via the cross-platform path in shell/common/switches.cc:553, so either path works.
- macOS:
FlutterDartProject.mm:97 reads the Info.plist key, plus the cross-platform switch path. Either works.
- Android:
FlutterEngineFlags.java:232 defines new Flag(\"--enable-flutter-gpu\", \"EnableFlutterGPU\", true); and FlutterLoader reads the EnableFlutterGPU manifest meta-data and converts it into the --enable-flutter-gpu engine switch. The flutter run --enable-flutter-gpu argument from the tool side does not appear to flow through to the engine's switch list, so settings.enable_flutter_gpu stays false.
Suggested fix
Make flutter run --enable-flutter-gpu propagate to the Android engine launch (add it to the engine arg list the tool passes to FlutterLoader / the activity) so the documented behavior is consistent with iOS/macOS.
Flutter version
Flutter 3.44.0-1.0.pre-380
Tools • Dart 3.13.0
Reproducible on the master channel; the code paths cited above are current.
Steps to reproduce
flutter_gpuon the first frame (e.g.flutter_scene). Any access togpu.gpuContexttriggers the runtime check.Expected results
The app launches with Flutter GPU enabled, matching the runtime error message which lists
--enable-flutter-gpuas a valid way to opt in (engine/src/flutter/lib/gpu/context.cc:53–58):…and matching the documented behavior on iOS/macOS where the CLI flag alone is sufficient.
Actual results
The app throws:
repeatedly on every frame, because
dart_state->IsFlutterGPUEnabled()returns false (engine/src/flutter/lib/gpu/context.cc:51).Adding the manifest opt-in to
android/app/src/main/AndroidManifest.xmlworks around it:Test matrix
Same minimal app, no
FLTEnableFlutterGPUinInfo.plist, noEnableFlutterGPUinAndroidManifest.xmlunless noted.--enable-flutter-gpu--enable-flutter-gpu--enable-flutter-gpuEnableFlutterGPU=true--enable-flutter-gpuEnableFlutterGPU=trueSo the CLI flag enables the API on iOS and macOS but not Android.
Where it diverges
FlutterDartProject.mm:226–228reads the Info.plist key. The--enable-flutter-gpuswitch also reachessettings.enable_flutter_gpuvia the cross-platform path inshell/common/switches.cc:553, so either path works.FlutterDartProject.mm:97reads the Info.plist key, plus the cross-platform switch path. Either works.FlutterEngineFlags.java:232definesnew Flag(\"--enable-flutter-gpu\", \"EnableFlutterGPU\", true);andFlutterLoaderreads theEnableFlutterGPUmanifest meta-data and converts it into the--enable-flutter-gpuengine switch. Theflutter run --enable-flutter-gpuargument from the tool side does not appear to flow through to the engine's switch list, sosettings.enable_flutter_gpustays false.Suggested fix
Make
flutter run --enable-flutter-gpupropagate to the Android engine launch (add it to the engine arg list the tool passes toFlutterLoader/ the activity) so the documented behavior is consistent with iOS/macOS.Flutter version
Reproducible on the
masterchannel; the code paths cited above are current.