Skip to content

camera_android_camerax: Failed to find supported resolutions (IllegalArgumentException) #135293

@andynewman10

Description

@andynewman10

Is there an existing issue for this?

Steps to reproduce

  1. Create a Flutter application using Flutter 3.13.3. I use VS Code on Windows.
  2. Design a basic camera application using:
camera: ^0.10.5+4
camera_android_camerax: ^0.5.0+18
  1. Create a camera controller in the following way:
    List<CameraDescription> cameras = await availableCameras();

    CameraDescription? cameraDescription;
    for (int i = 0; i < cameras.length; i++) {
      if (cameras[i].lensDirection == CameraLensDirection.back) {
        cameraDescription = cameras[i];
      }
    }

    if (cameraDescription == null) {
      throw Exception("Could not find any back-facing camera");
    }

    final cameraController = CameraController(
        cameraDescription, ResolutionPreset.medium,
        enableAudio: false, imageFormatGroup: ImageFormatGroup.yuv420);

    await cameraController.initialize();
  1. Run the application on an Android 13 device, I personally use a Google Pixel 6a.
  2. The following exception is thrown:
IllegalArgumentException: Failed to find supported resolutions
  1. Now, remove the following line from your pubspec.yaml:
# camera_android_camerax: ^0.5.0+18
  1. Run the application again: no error.

Expected results

The code should be running fine.

Actual results

Exception being thrown.

Code sample

Code sample
See above

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.13.3, on Microsoft Windows [version 10.0.22000.2416], locale fr-FR)
    • Flutter version 3.13.3 on channel stable at C:\Users\andy\Documents\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2524052335 (2 weeks ago), 2023-09-06 14:32:31 -0700
    • Engine revision b8d35810e9
    • Dart version 3.1.1
    • DevTools version 2.25.0

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\andy\AppData\Local\Android\sdk
    • Platform android-33, build-tools 34.0.0
    • Java binary at: C:\Users\andy\Documents\Applications\android-studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)
    • All Android licenses accepted.

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

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

[√] Android Studio (version 2022.2)
    • Android Studio at C:\Users\andy\Documents\Applications\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 11.0.15+0-b2043.56-9505619)

[√] IntelliJ IDEA Community Edition (version 2021.3)
    • IntelliJ at C:\Users\andy\Documents\Applications\IntelliJ
    • 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

[√] VS Code (version 1.82.2)
    • VS Code at C:\Users\andy\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.72.0

[√] Connected device (4 available)
    • Pixel 6a (mobile) • 29231JEGR03669 • android-arm64  • Android 13 (API 33)
    • Windows (desktop) • windows        • windows-x64    • Microsoft Windows [version 10.0.22000.2416]
    • Chrome (web)      • chrome         • web-javascript • Google Chrome 116.0.5845.188
    • Edge (web)        • edge           • web-javascript • Microsoft Edge 117.0.2045.36

[√] Network resources
    • 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.13Found to occur in 3.13found in release: 3.15Found to occur in 3.15has 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 specificallyr: fixedIssue is closed as already fixed in a newer versionteam-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