skip to Main Content

In Android 13 we are facing the below issue we are using this third-party camera plugin (https://pub.dev/packages/camera), I would really appreciate the help to solve the issue, Do we need to make some changes in our Android version?

E/flutter (14764): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: CameraException(error, Attempt to invoke virtual method 'int android.media.EncoderProfiles$VideoProfile.getWidth()' on a null object reference)
E/flutter (14764): #0      AndroidCamera.createCamera (package:camera_android/src/android_camera.dart:112:7)
E/flutter (14764): <asynchronous suspension>
E/flutter (14764): #1      CameraController.initialize (package:camera/src/camera_controller.dart:291:19)
E/flutter (14764): <asynchronous suspension>

2

Answers


  1. It’s a well known issue that is being tracked here:https://github.com/flutter/flutter/issues/109769
    some people came with a solution ( that I haven’t tried ) but as of the current state the issue is still not fixed in the latest package version

    Login or Signup to reply.
  2. This are the step i followed, It’s worked for me

    1. Flutter upgrade 3.3.8 to 3.7.10(7-4-2023)
    2. flutter pub cache clean
    3. dart version number changed in pubsec.yaml (2.16 to 2.18)
    4. flutter pub get
    5. It’s worked for me
    6. Tested with samsung galaxy A13 and vivo v27 pro.
    7. camera plugin version : 0.10.1
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search