Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[camera] In Android take photo, unlockAutoFocus error Fatal Exception: java.lang.NullPointerException is thrown #82031

Open
wisnuwiry opened this issue May 7, 2021 · 16 comments
Labels
a: production Issues experienced in live production apps c: fatal crash Crashes that terminate the process p: camera The camera plugin P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team

Comments

@wisnuwiry
Copy link

wisnuwiry commented May 7, 2021

Steps to Reproduce

This issue was experienced by some / many of my users when taking photos of the force close application. And to get this issue just take normal photos on one of the following devices:

  1. vivo 1915
  2. Oppo A1k
  3. vivo 1724
  4. realme C15
  5. Oppo F7
  6. vivo 1915
  7. Galaxy A50s

Another way to get this error might be by:

  1. Take capture continuously.

Dependencies in pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  dartz: ^0.10.0-nullsafety.1
  dio: ^4.0.0
  equatable: ^2.0.0
  flutter_bloc: ^7.0.0
  flutter_html: ^2.0.0-nullsafety.0
  formz: ^0.4.0-nullsafety.0
  get_it: ^6.1.0
  hive: ^2.0.2
  image_picker: ^0.7.4
  path_provider: ^2.0.1
  file_picker: ^3.0.1
  rxdart: ^0.26.0
  open_file: ^3.1.0
  pdf: ^3.2.0
  firebase_core: ^1.0.3
  firebase_messaging: ^9.1.1
  firebase_crashlytics: ^2.0.0
  firebase_performance: ^0.7.0
  firebase_analytics: ^8.0.0
  root_detector: ^0.0.3
  geolocator: ^7.0.2
  firebase_remote_config: ^0.10.0-dev.0
  package_info: ^2.0.0
  url_launcher: ^6.0.3
  shimmer: ^2.0.0
  intl: ^0.17.0
  camera: ^0.8.1
  google_maps_flutter: ^2.0.3
  timeline_tile: ^2.0.0
  permission_handler: ^7.1.0

Expected results:

Actual results:

image

Logs
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.camera2.CameraCaptureSession.capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession$CaptureCallback, android.os.Handler)' on a null object reference
       at io.flutter.plugins.camera.Camera.unlockAutoFocus(Camera.java:26)
       at io.flutter.plugins.camera.Camera.access$1900(Camera.java)
       at io.flutter.plugins.camera.Camera$4.onCaptureCompleted(Camera.java:2)
       at java.lang.reflect.Method.invoke(Method.java)
       at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39)
       at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:192)
       at android.app.ActivityThread.main(ActivityThread.java:6702)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)
## Running Verbose When Error:##

 +465 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[        ] W/ArrayUtils(20811): Ignoring invalid value asd
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[  +31 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[        ] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[        ] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[ +140 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[        ] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[   +1 ms] I/Camera  (20811): [FPS Range Available] is:[7500, 30000]
[   +1 ms] I/Camera  (20811): [FPS Range] is:[7500, 30000]
[ +345 ms] I/art     (20811): Thread[1,tid=20811,WaitingForJniOnLoad,Thread*=0xb7d270e8,peer=0x776d1000,"main"] recursive attempt to load library "/system/lib/libmedia_jni.so"
[   +7 ms] D/MtpDeviceJNI(20811): register_android_mtp_MtpDevice
[   +4 ms] I/art     (20811): Thread[1,tid=20811,WaitingForJniOnLoad,Thread*=0xb7d270e8,peer=0x776d1000,"main"] recursive attempt to load library "/system/lib/libmedia_jni.so"
[   +1 ms] I/art     (20811): Thread[1,tid=20811,WaitingForJniOnLoad,Thread*=0xb7d270e8,peer=0x776d1000,"main"] recursive attempt to load library "/system/lib/libmedia_jni.so"
[ +175 ms] D/SensorManager(20811): registerListener :: 0, K303C Accelerometer Sensor, 200000, 0,  
[  +93 ms] W/Camera  (20811): The selected imageFormatGroup is not supported by Android. Defaulting to yuv420
[  +12 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[        ] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[  +21 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[        ] W/ArrayUtils(20811): Ignoring invalid value beauty
[        ] W/ArrayUtils(20811): Ignoring invalid value asd
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[ +278 ms] I/CameraManager(20811): Using legacy camera HAL.
[ +188 ms] I/art     (20811): Background sticky concurrent mark sweep GC freed 40364(1887KB) AllocSpace objects, 7(112KB) LOS objects, 17% free, 9MB/11MB, paused 1.457ms total 506.425ms
[ +236 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[        ] W/ArrayUtils(20811): Ignoring invalid value flowers
[        ] W/ArrayUtils(20811): Ignoring invalid value AR
[ +203 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[        ] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[        ] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[        ] W/ArrayUtils(20811): Ignoring invalid value neon
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[  +13 ms] I/CameraDeviceState(20811): Legacy camera service transitioning to state CONFIGURING
[  +13 ms] I/RequestThread-1(20811): Configure outputs: 2 surfaces configured.
[   +3 ms] D/Camera  (20811): app passed NULL surface
[  +51 ms] I/RequestThread-1(20811): configureOutputs - set take picture size to 1280x720
[ +183 ms] I/CameraDeviceState(20811): Legacy camera service transitioning to state IDLE
[  +19 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[        ] W/ArrayUtils(20811): Ignoring invalid value beauty
[        ] W/ArrayUtils(20811): Ignoring invalid value asd
[        ] W/ArrayUtils(20811): Ignoring invalid value backlight
[        ] W/ArrayUtils(20811): Ignoring invalid value flowers
[        ] W/ArrayUtils(20811): Ignoring invalid value AR
[  +17 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[        ] W/ArrayUtils(20811): Ignoring invalid value asd
[        ] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[  +14 ms] I/RequestQueue(20811): Repeating capture request set.
[  +13 ms] W/LegacyRequestMapper(20811): convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[   +4 ms] W/LegacyRequestMapper(20811): mapAeAndFlashMode - Ignore control.aeMode == ON_AUTO_FLASH;camera does not support it
[   +5 ms] W/LegacyRequestMapper(20811): convertRequestToMetadata - Ignoring android.lens.focusDistance false, only 0.0f is supported
[  +58 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[        ] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[        ] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[+1037 ms] I/CameraDeviceState(20811): Legacy camera service transitioning to state CAPTURING
[+1367 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[ +221 ms] I/RequestQueue(20811): Repeating capture request cancelled.
[   +8 ms] I/RequestQueue(20811): Repeating capture request set.
[   +1 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[ +112 ms] W/LegacyRequestMapper(20811): convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[   +2 ms] W/LegacyRequestMapper(20811): mapAeAndFlashMode - Ignore control.aeMode == ON_AUTO_FLASH;camera does not support it
[        ] W/LegacyRequestMapper(20811): convertRequestToMetadata - Ignoring android.lens.focusDistance false, only 0.0f is supported
[   +1 ms] I/RequestQueue(20811): Repeating capture request cancelled.
[  +28 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[  +86 ms] W/LegacyRequestMapper(20811): convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[   +2 ms] W/LegacyRequestMapper(20811): Only received metering rectangles with weight 0.
[   +3 ms] W/LegacyRequestMapper(20811): mapAeAndFlashMode - Ignore control.aeMode == ON_AUTO_FLASH;camera does not support it
[   +3 ms] W/LegacyRequestMapper(20811): convertRequestToMetadata - Ignoring android.lens.focusDistance false, only 0.0f is supported
[  +35 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[ +160 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[ +151 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[ +294 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[  +47 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[ +134 ms] I/RequestThread-1(20811): Received jpeg.
[   +1 ms] I/RequestThread-1(20811): Producing jpeg buffer...
[  +19 ms] I/CameraDeviceState(20811): Legacy camera service transitioning to state IDLE
[  +46 ms] D/ImageReader_JNI(20811): ImageReader_imageSetup: Receiving JPEG in HAL_PIXEL_FORMAT_RGBA_8888 buffer.
[   +7 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +6 ms] I/RequestQueue(20811): Repeating capture request set.
[   +1 ms] I/flutter (20811): /data/data/id.co.krista.mobile/cache/CAP-2063246489.jpg
[   +6 ms] W/LegacyRequestMapper(20811): convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[   +4 ms] W/LegacyRequestMapper(20811): mapAeAndFlashMode - Ignore control.aeMode == ON_AUTO_FLASH;camera does not support it
[   +3 ms] W/LegacyRequestMapper(20811): convertRequestToMetadata - Ignoring android.lens.focusDistance false, only 0.0f is supported
[  +23 ms] I/RequestQueue(20811): Repeating capture request cancelled.
[+1386 ms] I/CameraDeviceState(20811): Legacy camera service transitioning to state CAPTURING
[ +336 ms] E/BufferQueueProducer(20811): [unnamed-20811-3] cancelBuffer: BufferQueue has been abandoned
[   +2 ms] E/BufferQueueProducer(20811): [unnamed-20811-3] cancelBuffer: BufferQueue has been abandoned
[   +1 ms] E/BufferQueueProducer(20811): [unnamed-20811-3] cancelBuffer: BufferQueue has been abandoned
[   +1 ms] E/BufferQueueProducer(20811): [unnamed-20811-3] cancelBuffer: BufferQueue has been abandoned
[   +1 ms] E/BufferQueueProducer(20811): [unnamed-20811-3] cancelBuffer: BufferQueue has been abandoned
[   +1 ms] E/BufferQueueProducer(20811): [unnamed-20811-3] cancelBuffer: BufferQueue has been abandoned
[ +303 ms] D/SensorManager(20811): unregisterListener ::   
[  +32 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[  +26 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +6 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[        ] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[        ] W/ArrayUtils(20811): Ignoring invalid value point-blue
[        ] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[        ] W/ArrayUtils(20811): Ignoring invalid value neon
[        ] W/ArrayUtils(20811): Ignoring invalid value beauty
[        ] W/ArrayUtils(20811): Ignoring invalid value asd
[        ] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[        ] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +1 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +1 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +1 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +2 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +1 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +1 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +1 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +9 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[        ] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[        ] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[   +2 ms] I/Camera  (20811): [FPS Range Available] is:[7500, 30000]
[        ] I/Camera  (20811): [FPS Range] is:[7500, 30000]
[  +17 ms] D/SensorManager(20811): registerListener :: 0, K303C Accelerometer Sensor, 200000, 0,  
[  +68 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[  +96 ms] W/Camera  (20811): The selected imageFormatGroup is not supported by Android. Defaulting to yuv420
[   +7 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[  +18 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[   +2 ms] I/CameraManager(20811): Using legacy camera HAL.
[ +179 ms] I/art     (20811): Background partial concurrent mark sweep GC freed 44229(2036KB) AllocSpace objects, 4(227KB) LOS objects, 24% free, 9MB/12MB, paused 1.341ms total 216.671ms
[  +66 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +4 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[  +91 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[   +2 ms] W/MessageQueue(20811): Handler (android.os.Handler) {2b3bd961} sending message to a Handler on a dead thread
[   +1 ms] W/MessageQueue(20811): java.lang.IllegalStateException: Handler (android.os.Handler) {2b3bd961} sending message to a Handler on a dead thread
[   +1 ms] W/MessageQueue(20811):       at android.os.MessageQueue.enqueueMessage(MessageQueue.java:325)
[        ] W/MessageQueue(20811):       at android.os.Handler.enqueueMessage(Handler.java:631)
[   +2 ms] W/MessageQueue(20811):       at android.os.Handler.sendMessageAtFrontOfQueue(Handler.java:623)
[   +1 ms] W/MessageQueue(20811):       at android.hardware.camera2.legacy.RequestThreadManager.quit(RequestThreadManager.java:941)
[  +22 ms] W/MessageQueue(20811):       at android.hardware.camera2.legacy.LegacyCameraDevice.close(LegacyCameraDevice.java:444)
[   +2 ms] W/MessageQueue(20811):       at android.hardware.camera2.legacy.LegacyCameraDevice.finalize(LegacyCameraDevice.java:468)
[   +1 ms] W/MessageQueue(20811):       at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:209)
[   +2 ms] W/MessageQueue(20811):       at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:192)
[   +1 ms] W/MessageQueue(20811):       at java.lang.Thread.run(Thread.java:818)
[   +4 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[        ] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +4 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[        ] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[        ] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +4 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[   +2 ms] I/CameraDeviceState(20811): Legacy camera service transitioning to state CONFIGURING
[   +4 ms] I/RequestThread-1(20811): Configure outputs: 2 surfaces configured.
[   +1 ms] D/Camera  (20811): app passed NULL surface
[        ] I/RequestThread-1(20811): configureOutputs - set take picture size to 1280x720
[   +3 ms] I/CameraDeviceState(20811): Legacy camera service transitioning to state IDLE
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[        ] W/ArrayUtils(20811): Ignoring invalid value neon
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value beauty
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value asd
[        ] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +3 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[        ] I/RequestQueue(20811): Repeating capture request set.
[        ] W/LegacyRequestMapper(20811): convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[   +1 ms] W/LegacyRequestMapper(20811): mapAeAndFlashMode - Ignore control.aeMode == ON_AUTO_FLASH;camera does not support it
[   +1 ms] W/LegacyRequestMapper(20811): convertRequestToMetadata - Ignoring android.lens.focusDistance false, only 0.0f is supported
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value vintage-cold
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value point-blue
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value point-red-yellow
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value emboss
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value sketch
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value neon
[        ] W/ArrayUtils(20811): Ignoring invalid value beauty
[        ] W/ArrayUtils(20811): Ignoring invalid value asd
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value backlight
[   +2 ms] W/ArrayUtils(20811): Ignoring invalid value flowers
[   +1 ms] W/ArrayUtils(20811): Ignoring invalid value AR
[ +823 ms] I/CameraDeviceState(20811): Legacy camera service transitioning to state CAPTURING
[+1052 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[ +111 ms] I/RequestQueue(20811): Repeating capture request cancelled.
[   +2 ms] I/RequestQueue(20811): Repeating capture request set.
[  +85 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[  +42 ms] W/LegacyRequestMapper(20811): convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[   +6 ms] W/LegacyRequestMapper(20811): mapAeAndFlashMode - Ignore control.aeMode == ON_AUTO_FLASH;camera does not support it
[   +3 ms] W/LegacyRequestMapper(20811): convertRequestToMetadata - Ignoring android.lens.focusDistance false, only 0.0f is supported
[  +79 ms] I/RequestQueue(20811): Repeating capture request cancelled.
[  +43 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[  +90 ms] W/LegacyRequestMapper(20811): convertRequestMetadata - control.awbRegions setting is not supported, ignoring value
[   +1 ms] W/LegacyRequestMapper(20811): Only received metering rectangles with weight 0.
[        ] W/LegacyRequestMapper(20811): mapAeAndFlashMode - Ignore control.aeMode == ON_AUTO_FLASH;camera does not support it
[   +1 ms] W/LegacyRequestMapper(20811): convertRequestToMetadata - Ignoring android.lens.focusDistance false, only 0.0f is supported
[ +189 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[ +189 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[ +198 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[ +167 ms] I/RequestThread-1(20811): Received jpeg.
[   +2 ms] I/RequestThread-1(20811): Producing jpeg buffer...
[   +2 ms] D/ImageReader_JNI(20811): ImageReader_imageSetup: Receiving JPEG in HAL_PIXEL_FORMAT_RGBA_8888 buffer.
[  +11 ms] I/flutter (20811): /data/data/id.co.krista.mobile/cache/CAP1233186859.jpg
[   +3 ms] I/CameraDeviceState(20811): Legacy camera service transitioning to state IDLE
[ +196 ms] D/SensorManager(20811): unregisterListener ::   
[   +2 ms] D/ViewRootImpl(20811): ViewPostImeInputStage ACTION_DOWN
[   +9 ms] D/AndroidRuntime(20811): Shutting down VM
[ +505 ms] D/TransportRuntime.SQLiteEventStore(20811): Storing event with priority=HIGHEST, name=FIREBASE_CRASHLYTICS_REPORT for destination cct
[  +17 ms] D/TransportRuntime.JobInfoScheduler(20811): Scheduling upload for context TransportContext(cct, HIGHEST,
MSRodHRwczovL2NyYXNobHl0aWNzcmVwb3J0cy1wYS5nb29nbGVhcGlzLmNvbS92MS9maXJlbG9nL2xlZ2FjeS9iYXRjaGxvZ1xBSXphU3lCcnBTWVQ0RkZMMDlyZUhKaTZIOUZZZGVpU25VVE92Mk0=) with jobId=-1909444295 in
1000ms(Backend next call timestamp 0). Attempt 1
[ +480 ms] E/AndroidRuntime(20811): FATAL EXCEPTION: main
[   +1 ms] E/AndroidRuntime(20811): Process: id.co.krista.mobile, PID: 20811
[   +2 ms] E/AndroidRuntime(20811): java.lang.NullPointerException: Attempt to invoke virtual method 'int
android.hardware.camera2.CameraCaptureSession.capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession$CaptureCallback, android.os.Handler)' on a null 
object reference
[   +2 ms] E/AndroidRuntime(20811):     at io.flutter.plugins.camera.Camera.unlockAutoFocus(Camera.java:611)
[   +2 ms] E/AndroidRuntime(20811):     at io.flutter.plugins.camera.Camera.access$1900(Camera.java:74)
[   +1 ms] E/AndroidRuntime(20811):     at io.flutter.plugins.camera.Camera$4.onCaptureCompleted(Camera.java:589)
[   +2 ms] E/AndroidRuntime(20811):     at java.lang.reflect.Method.invoke(Native Method)
[   +1 ms] E/AndroidRuntime(20811):     at java.lang.reflect.Method.invoke(Method.java:372)
[   +3 ms] E/AndroidRuntime(20811):     at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39)
[   +3 ms] E/AndroidRuntime(20811):     at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65)
[   +3 ms] E/AndroidRuntime(20811):     at android.os.Handler.handleCallback(Handler.java:739)
[   +1 ms] E/AndroidRuntime(20811):     at android.os.Handler.dispatchMessage(Handler.java:95)
[   +1 ms] E/AndroidRuntime(20811):     at android.os.Looper.loop(Looper.java:135)
[        ] E/AndroidRuntime(20811):     at android.app.ActivityThread.main(ActivityThread.java:5753)
[   +1 ms] E/AndroidRuntime(20811):     at java.lang.reflect.Method.invoke(Native Method)
[   +2 ms] E/AndroidRuntime(20811):     at java.lang.reflect.Method.invoke(Method.java:372)
[   +2 ms] E/AndroidRuntime(20811):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
[   +1 ms] E/AndroidRuntime(20811):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
[+7646 ms] W/art     (20811): Suspending all threads took: 53.210ms
[  +72 ms] W/MessageQueue(20811): Handler (android.os.Handler) {2470e404} sending message to a Handler on a dead thread
[   +1 ms] W/MessageQueue(20811): java.lang.IllegalStateException: Handler (android.os.Handler) {2470e404} sending message to a Handler on a dead thread
[        ] W/MessageQueue(20811):       at android.os.MessageQueue.enqueueMessage(MessageQueue.java:325)
[        ] W/MessageQueue(20811):       at android.os.Handler.enqueueMessage(Handler.java:631)
[        ] W/MessageQueue(20811):       at android.os.Handler.sendMessageAtFrontOfQueue(Handler.java:623)
[        ] W/MessageQueue(20811):       at android.hardware.camera2.legacy.RequestThreadManager.quit(RequestThreadManager.java:941)
[   +1 ms] W/MessageQueue(20811):       at android.hardware.camera2.legacy.LegacyCameraDevice.close(LegacyCameraDevice.java:444)
[   +2 ms] W/MessageQueue(20811):       at android.hardware.camera2.legacy.LegacyCameraDevice.finalize(LegacyCameraDevice.java:468)
[   +1 ms] W/MessageQueue(20811):       at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:209)
[   +2 ms] W/MessageQueue(20811):       at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:192)
[   +2 ms] W/MessageQueue(20811):       at java.lang.Thread.run(Thread.java:818)

[√] Flutter (Channel stable, 2.0.4, on Microsoft Windows [Version 10.0.19041.928], locale en-ID)
    • Flutter version 2.0.4 at C:\flutter
    • Framework revision b1395592de (5 weeks ago), 2021-04-01 14:25:01 -0700
    • Engine revision 2dce47073a
    • Dart version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
    • Android SDK at C:\Users\wisnu\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java       
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

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

[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 4.1.0)
    • 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 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.56.0)
    • VS Code at C:\Users\wisnu\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.22.0

[√] Connected device (4 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
    • Windows (desktop)                  • windows       • windows-x64    • Microsoft Windows [Version 10.0.19041.928]
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 90.0.4430.93
    • Edge (web)                         • edge          • web-javascript • Microsoft Edge 90.0.818.49

! Doctor found issues in 1 category.
@TahaTesser TahaTesser added the in triage Presently being triaged by the triage team label May 7, 2021
@TahaTesser
Copy link
Member

TahaTesser commented May 7, 2021

Hi @wisnuwiry

many of my users when taking photos of the force close application

Can you please explain " taking photos of the force close application"? If you have reproducible steps of the issue, please provide complete steps

Can you please provide your flutter doctor -v, your pubspec.yaml, if possible your flutter run --release --verbose running on the same OS version as the affected devices with the crash
Thank you

@TahaTesser TahaTesser added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 7, 2021
@wisnuwiry
Copy link
Author

@TahaTesser I have updated it in the issue body above.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 7, 2021
@TahaTesser TahaTesser changed the title [camera] In Android take foto unlockAutoFocus error Fatal Exception: java.lang.NullPointerException [camera] In Android take photo, unlockAutoFocus error Fatal Exception: java.lang.NullPointerException is thrown May 10, 2021
@TahaTesser TahaTesser added a: production Issues experienced in live production apps p: camera The camera plugin p: first party platform-android Android applications specifically c: fatal crash Crashes that terminate the process and removed in triage Presently being triaged by the triage team labels May 10, 2021
@cyanglaz cyanglaz added the P2 Important issues not at the top of the work list label May 13, 2021
@warhsn
Copy link

warhsn commented May 21, 2021

We're seeing the same thing here.

Devices affected so far:

  • Galaxy S21 5G
  • Galaxy S10
  • HUAWEI Y5 lite
  • S55 Nova
  • Oppo 15

Stack trace from Crashlytics

Screenshot 2021-05-21 at 07 25 02

Output from flutter analyze

flutter analyze
Analyzing assetpool-flutter...                                          
No issues found! (ran in 10.4s)

We are unable to reproduce this locally as we don't have any of the devices mentioned above on hand.

@warhsn
Copy link

warhsn commented May 25, 2021

@wisnuwiry since we're not getting any responses, have you managed to solve this issue?

@slorop41314
Copy link

slorop41314 commented Jul 12, 2021

Any solving for this issue?

Also got the error on

  • Galaxy j1 Ace
  • Redmi 4A
  • Oppo A37F

@nguyen95
Copy link

nguyen95 commented Aug 2, 2021

Is there any solutions for this problem? It's been almost 3 months.

@torbenkeller
Copy link

We are also facing this Issue.

We got 2 different StackTraces for it:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.camera2.CameraCaptureSession.capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession$CaptureCallback, android.os.Handler)' on a null object reference
       at io.flutter.plugins.camera.Camera.unlockAutoFocus(Camera.java:648)
       at io.flutter.plugins.camera.Camera.access$700(Camera.java:83)
       at io.flutter.plugins.camera.Camera$3.onCaptureCompleted(Camera.java:559)
       at android.hardware.camera2.impl.CameraCaptureSessionImpl$1.lambda$onCaptureCompleted$3$CameraCaptureSessionImpl$1(CameraCaptureSessionImpl.java:693)
       at android.hardware.camera2.impl.-$$Lambda$CameraCaptureSessionImpl$1$OA1Yz_YgzMO8qcV8esRjyt7ykp4.run(:8)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:233)
       at android.os.HandlerThread.run(HandlerThread.java:67)

and

Fatal Exception: java.lang.IllegalStateException: Session has been closed; further changes are illegal.
       at android.hardware.camera2.impl.CameraCaptureSessionImpl.checkNotClosed(CameraCaptureSessionImpl.java:886)
       at android.hardware.camera2.impl.CameraCaptureSessionImpl.capture(CameraCaptureSessionImpl.java:179)
       at io.flutter.plugins.camera.Camera.unlockAutoFocus(Camera.java:648)
       at io.flutter.plugins.camera.Camera.access$700(Camera.java:83)
       at io.flutter.plugins.camera.Camera$3.onCaptureCompleted(Camera.java:559)
       at android.hardware.camera2.impl.CameraCaptureSessionImpl$1.lambda$onCaptureCompleted$3$CameraCaptureSessionImpl$1(CameraCaptureSessionImpl.java:692)
       at android.hardware.camera2.impl.-$$Lambda$CameraCaptureSessionImpl$1$OA1Yz_YgzMO8qcV8esRjyt7ykp4.run(:8)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:246)
       at android.os.HandlerThread.run(HandlerThread.java:67)

In our case it failed on the devices:

  • Samsung Galaxy A72 (Android 11)
  • Samsung Galaxy A40 (Android 11)
  • Samsung Galaxy S20 5G (Android 11)
  • Samsung Galaxy S10e (Android 11)
  • Samsung Galaxy S10 (Android 11)
  • Samsung Galaxy S9+ (Android 10)
  • Samsung Galaxy A71 (Android 11)
  • Xiaomi Mi 11 Lite 5G (Android 11)

We also have none of the devices to reproduce it locally.

@TahaTesser
Copy link
Member

Hi everyone
I have tried the following devices with autofocus, taken continuous pictures with the latest camera: ^0.9.2+2 and there is no such exception

  • Oneplus 8 (Android 11)
  • Xiaomi K20 Pro (Android 11)
  • Samsung M02s (Android 11)

Can you please upgrade to the latest stable and importantly latest camera: ^0.9.2+2 then try again
Execute the following commands to upgrade
flutter channel stable
flutter upgrade --force
flutter doctor -v

@TahaTesser TahaTesser added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 3, 2021
@carman247
Copy link

Also getting this running a slightly modified camera 0.9.2+2 ... however, this picture below shows the only modification and it is essential for some Huawei devices.

Screenshot 2021-09-22 at 09 08 29 (2)

Device

  • Galaxy A10

Stacktrace

io.flutter.plugins.camera.Camera.unlockAutoFocus (Camera.java:65)
io.flutter.plugins.camera.Camera.access$700 (Camera.java)
io.flutter.plugins.camera.Camera$3.onCaptureCompleted (Camera.java:2)
android.hardware.camera2.impl.CameraCaptureSessionImpl$1.lambda$onCaptureCompleted$3$CameraCaptureSessionImpl$1 (CameraCaptureSessionImpl.java:692)
android.hardware.camera2.impl.-$$Lambda$CameraCaptureSessionImpl$1$OA1Yz_YgzMO8qcV8esRjyt7ykp4.run (-.java:8)
android.os.Handler.handleCallback (Handler.java:938)
android.os.Handler.dispatchMessage (Handler.java:99)
android.os.Looper.loop (Looper.java:246)
android.os.HandlerThread.run (HandlerThread.java:67)

Flutter doctor -v

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.2.1 20D75 darwin-x64, locale en-GB)
    • Flutter version 2.2.3 at /Users/chris/Developer/flutter
    • Framework revision f4abaa0735 (3 months ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/chris/Library/Android/sdk
    • Platform android-30, build-tools 29.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.0

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

[✓] Android Studio (version 4.1)
    • 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 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.60.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.26.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.114

@TahaTesser TahaTesser removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Sep 22, 2021
@TahaTesser
Copy link
Member

TahaTesser commented Sep 22, 2021

Removing wait label since this seems to be a legit issue that I can't reproduce with my devices using code sample #82031 (comment)

@ukbaranwal31
Copy link

ukbaranwal31 commented Sep 22, 2021

I am also facing the same issue.
Mostly happening on Android 11
When you force close the application and then launch it to capture, that's when it happens
Try galaxy A50... I reproduced it multiple times

@krispypen
Copy link
Contributor

We're also having this issue on an OPPO A15 (CPH2185). It's not always, but most of the time.
Strange thing is it checks if captureSession is not null, and 2 lines later it's already null https://github.com/flutter/plugins/blob/90b2844ce7e58c2c5466303f8d6e8adf031d0f19/packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java#L641

@krispypen
Copy link
Contributor

final file = await cameraController.takePicture();
await cameraController.dispose()

I found that the takePicture on Android starts doing stuff in the background after it receives the image, if you dispose after takePicture that background task could still be running and crash your application because of NullPointerExceptions or security exceptions, so a dirty workaround for now is waiting 500ms until you dispose the cameraController

@derng
Copy link

derng commented Apr 20, 2022

I am experiencing this issue on a Galaxy S9, and can consistently reproduce this calling takePicture and immediately disposing the controller at minimum of 2 cycles. @krispypen workaround helped in my case 👍

@rraayy
Copy link

rraayy commented Aug 13, 2022

I'm facing this issue on Galaxy S7 edge and randomly crash after calling takePicture
The dirty workaround waiting 500ms helps me. Thank @krispypen !

@camsim99
Copy link
Contributor

This issue should be fixed in the CameraX implementation of the camera plugin, so please try it out!

If you find a similar issue with that implementation (or any other issues), please feel free to file a separate issue.

@github-project-automation github-project-automation bot moved this to [PENDING] camera_android issues solved by camera_android_camerax in Android Camera Re-write Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: production Issues experienced in live production apps c: fatal crash Crashes that terminate the process p: camera The camera plugin P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team
Projects
Status: [PENDING] camera_android issues solved by camera_android_camerax
Development

No branches or pull requests