Skip to content

[camera_android_camerax] Wrong ImageFormatGroup for nv21 causes ML Kit incompatibility #174923

@pfistnerm

Description

@pfistnerm

Steps to reproduce

_controller = CameraController(
  camera,
  ResolutionPreset.high,
  enableAudio: false,
  imageFormatGroup: Platform.isAndroid ? ImageFormatGroup.nv21 : ImageFormatGroup.bgra8888,
);

// Prints "ImageFormatGroup: ImageFormatGroup.yuv420"
_controller!.startImageStream(
  (image) => print('ImageFormatGroup: ${image.format.group}'),
);

Expected results

"ImageFormatGroup: ImageFormatGroup.nv21"

Actual results

"ImageFormatGroup: ImageFormatGroup.yuv420"

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.35.2, on Microsoft Windows [Version 10.0.26100.4946], locale en-CH) [168ms]
    • Flutter version 3.35.2 on channel stable at C:\Tools\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 05db968908 (10 days ago), 2025-08-25 10:21:35 -0700
    • Engine revision a8bfdfc394
    • Dart version 3.9.0
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android,
      enable-ios, cli-animations, enable-lldb-debugging

[√] Windows Version (11 Home 64-bit, 24H2, 2009) [471ms]

[√] Android toolchain - develop for Android devices (Android SDK version 36.1.0-rc1) [1,392ms]
    • Android SDK at C:\Users\Micha\AppData\Local\Android\sdk
    • Emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
    • Platform android-36-ext19, build-tools 36.1.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)
    • All Android licenses accepted.

[√] Chrome - develop for the web [49ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.2) [48ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.9.34622.214
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2023.3) [6ms]
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)

[√] VS Code (version 1.103.2) [5ms]
    • VS Code at C:\Users\Micha\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.118.0

[√] Connected device (3 available) [107ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26100.4946]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 140.0.7339.80
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 139.0.3405.125

[√] Network resources [345ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listfound in release: 3.35Found to occur in 3.35found in release: 3.36Found to occur in 3.36has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions