Skip to content

[Camera] cameraController.takePicture() crash app on call #92729

Closed

Description

@Os-Prog

Hello, I'm having issues with the Flutter camera plugin on Android, The app crashes whenever the _cameraController.takePicture() is called.

I'm using the latest camera version: camera: ^0.9.4+3

This is the error I'm getting:

E/AndroidRuntime( 5833): FATAL EXCEPTION: CameraBackground
E/AndroidRuntime( 5833): Process: com.net...., PID: 5833
E/AndroidRuntime( 5833): java.lang.IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface!
E/AndroidRuntime( 5833): at android.hardware.camera2.CaptureRequest.convertSurfaceToStreamId(CaptureRequest.java:739)
E/AndroidRuntime( 5833): at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:1215)
E/AndroidRuntime( 5833): at android.hardware.camera2.impl.CameraDeviceImpl.capture(CameraDeviceImpl.java:1087)
E/AndroidRuntime( 5833): at android.hardware.camera2.impl.CameraCaptureSessionImpl.capture(CameraCaptureSessionImpl.java:189)
E/AndroidRuntime( 5833): at io.flutter.plugins.camera.Camera.takePictureAfterPrecapture(Camera.java:564)
E/AndroidRuntime( 5833): at io.flutter.plugins.camera.Camera.onConverged(Camera.java:171)
E/AndroidRuntime( 5833): at io.flutter.plugins.camera.CameraCaptureCallback.process(CameraCaptureCallback.java:135)
E/AndroidRuntime( 5833): at io.flutter.plugins.camera.CameraCaptureCallback.onCaptureCompleted(CameraCaptureCallback.java:169)
E/AndroidRuntime( 5833): at android.hardware.camera2.impl.CameraCaptureSessionImpl$1.lambda$onCaptureCompleted$3$CameraCaptureSessionImpl$1(CameraCaptureSessionImpl.java:693)
E/AndroidRuntime( 5833): at android.hardware.camera2.impl.CameraCaptureSessionImpl$1$$ExternalSyntheticLambda6.run(Unknown Source:8)
E/AndroidRuntime( 5833): at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime( 5833): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 5833): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime( 5833): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime( 5833): at android.os.HandlerThread.run(HandlerThread.java:67)

Activity

  1. darshankawar commented on Nov 1, 2021

    @darshankawar
    Member

    @Os-Prog
    Can you provide more details as how you are calling takePicture() ? Do you use / call it while using the live stream ?
    Also share your flutter doctor -v /

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 1, 2021
  3. Os-Prog commented on Nov 1, 2021

    @Os-Prog
    Author

    Yes, I'm calling the function while live streaming,

    and this is my flutter doctor -v result:

    [✓] Flutter (Channel stable, 2.5.3, on macOS 11.5 20G71 darwin-arm, locale
    en-US)
    • Flutter version 2.5.3 at /Users/osprog/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 1811693 (2 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/osprog/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android
    Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.11.2

    [✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

    [✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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.10+0-b96-7249189)

    [✓] VS Code (version 1.61.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
    🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

    [✓] Connected device (2 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12
    (API 31) (emulator)
    • Chrome (web) • chrome • web-javascript • Google
    Chrome 95.0.4638.69

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Nov 1, 2021
  5. darshankawar commented on Nov 2, 2021

    @darshankawar
    Member

    @Os-Prog
    Currently it doesn't seem to support using live stream, so you can follow-up in this original issue for further reference and updates. Closing this as a duplicate.

  6. added
    r: duplicateIssue is closed as a duplicate of an existing issue
    and removed
    in triagePresently being triaged by the triage team
    on Nov 2, 2021
  7. github-actions commented on Nov 16, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions