Repository: flutter
Issue: [camera] Camera 0.11+ API stops working  Activity io.flutter.embedding.android.FlutterActivity has leaked IntentReceiver io.flutter.plugins.camerax.DeviceOrientationManager
Labels: platform-android,a: existing-apps,p: camera,has reproducible steps,P2,team-android,triaged-android,found in release: 3.24,found in release: 3.26

### What package does this bug report belong to?

camera

### What target platforms are you seeing this bug on?

Android

### Have you already upgraded your packages?

Yes

### Dependency versions

<details><summary>pubspec.lock</summary>

```lock
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
  async:
    dependency: transitive
    description:
      name: async
      sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
      url: "https://pub.dev"
    source: hosted
    version: "2.11.0"
  boolean_selector:
    dependency: transitive
    description:
      name: boolean_selector
      sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.1"
  camera:
    dependency: "direct main"
    description:
      name: camera
      sha256: "26ff41045772153f222ffffecba711a206f670f5834d40ebf5eed3811692f167"
      url: "https://pub.dev"
    source: hosted
    version: "0.11.0+2"
  camera_android_camerax:
    dependency: transitive
    description:
      name: camera_android_camerax
      sha256: "7cd93578ad201dcc6bb5810451fb00d76a86bab9b68dceb68b8cbd7038ac5846"
      url: "https://pub.dev"
    source: hosted
    version: "0.6.8+3"
  camera_avfoundation:
    dependency: transitive
    description:
      name: camera_avfoundation
      sha256: "7c28969a975a7eb2349bc2cb2dfe3ad218a33dba9968ecfb181ce08c87486655"
      url: "https://pub.dev"
    source: hosted
    version: "0.9.17+3"
  camera_platform_interface:
    dependency: transitive
    description:
      name: camera_platform_interface
      sha256: b3ede1f171532e0d83111fe0980b46d17f1aa9788a07a2fbed07366bbdbb9061
      url: "https://pub.dev"
    source: hosted
    version: "2.8.0"
  camera_web:
    dependency: transitive
    description:
      name: camera_web
      sha256: "595f28c89d1fb62d77c73c633193755b781c6d2e0ebcd8dc25b763b514e6ba8f"
      url: "https://pub.dev"
    source: hosted
    version: "0.3.5"
  characters:
    dependency: transitive
    description:
      name: characters
      sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
      url: "https://pub.dev"
    source: hosted
    version: "1.3.0"
  clock:
    dependency: transitive
    description:
      name: clock
      sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
      url: "https://pub.dev"
    source: hosted
    version: "1.1.1"
  collection:
    dependency: transitive
    description:
      name: collection
      sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
      url: "https://pub.dev"
    source: hosted
    version: "1.18.0"
  cross_file:
    dependency: transitive
    description:
      name: cross_file
      sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670"
      url: "https://pub.dev"
    source: hosted
    version: "0.3.4+2"
  csslib:
    dependency: transitive
    description:
      name: csslib
      sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb"
      url: "https://pub.dev"
    source: hosted
    version: "1.0.0"
  cupertino_icons:
    dependency: "direct main"
    description:
      name: cupertino_icons
      sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
      url: "https://pub.dev"
    source: hosted
    version: "1.0.8"
  fake_async:
    dependency: transitive
    description:
      name: fake_async
      sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
      url: "https://pub.dev"
    source: hosted
    version: "1.3.1"
  flutter:
    dependency: "direct main"
    description: flutter
    source: sdk
    version: "0.0.0"
  flutter_lints:
    dependency: "direct dev"
    description:
      name: flutter_lints
      sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
      url: "https://pub.dev"
    source: hosted
    version: "4.0.0"
  flutter_plugin_android_lifecycle:
    dependency: transitive
    description:
      name: flutter_plugin_android_lifecycle
      sha256: "9ee02950848f61c4129af3d6ec84a1cfc0e47931abc746b03e7a3bc3e8ff6eda"
      url: "https://pub.dev"
    source: hosted
    version: "2.0.22"
  flutter_test:
    dependency: "direct dev"
    description: flutter
    source: sdk
    version: "0.0.0"
  flutter_web_plugins:
    dependency: transitive
    description: flutter
    source: sdk
    version: "0.0.0"
  html:
    dependency: transitive
    description:
      name: html
      sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a"
      url: "https://pub.dev"
    source: hosted
    version: "0.15.4"
  leak_tracker:
    dependency: transitive
    description:
      name: leak_tracker
      sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
      url: "https://pub.dev"
    source: hosted
    version: "10.0.5"
  leak_tracker_flutter_testing:
    dependency: transitive
    description:
      name: leak_tracker_flutter_testing
      sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
      url: "https://pub.dev"
    source: hosted
    version: "3.0.5"
  leak_tracker_testing:
    dependency: transitive
    description:
      name: leak_tracker_testing
      sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
      url: "https://pub.dev"
    source: hosted
    version: "3.0.1"
  lints:
    dependency: transitive
    description:
      name: lints
      sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
      url: "https://pub.dev"
    source: hosted
    version: "4.0.0"
  matcher:
    dependency: transitive
    description:
      name: matcher
      sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
      url: "https://pub.dev"
    source: hosted
    version: "0.12.16+1"
  material_color_utilities:
    dependency: transitive
    description:
      name: material_color_utilities
      sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
      url: "https://pub.dev"
    source: hosted
    version: "0.11.1"
  meta:
    dependency: transitive
    description:
      name: meta
      sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
      url: "https://pub.dev"
    source: hosted
    version: "1.15.0"
  path:
    dependency: transitive
    description:
      name: path
      sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
      url: "https://pub.dev"
    source: hosted
    version: "1.9.0"
  plugin_platform_interface:
    dependency: transitive
    description:
      name: plugin_platform_interface
      sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.8"
  sky_engine:
    dependency: transitive
    description: flutter
    source: sdk
    version: "0.0.99"
  source_span:
    dependency: transitive
    description:
      name: source_span
      sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
      url: "https://pub.dev"
    source: hosted
    version: "1.10.0"
  stack_trace:
    dependency: transitive
    description:
      name: stack_trace
      sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
      url: "https://pub.dev"
    source: hosted
    version: "1.11.1"
  stream_channel:
    dependency: transitive
    description:
      name: stream_channel
      sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
      url: "https://pub.dev"
    source: hosted
    version: "2.1.2"
  stream_transform:
    dependency: transitive
    description:
      name: stream_transform
      sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.0"
  string_scanner:
    dependency: transitive
    description:
      name: string_scanner
      sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
      url: "https://pub.dev"
    source: hosted
    version: "1.2.0"
  term_glyph:
    dependency: transitive
    description:
      name: term_glyph
      sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
      url: "https://pub.dev"
    source: hosted
    version: "1.2.1"
  test_api:
    dependency: transitive
    description:
      name: test_api
      sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
      url: "https://pub.dev"
    source: hosted
    version: "0.7.2"
  vector_math:
    dependency: transitive
    description:
      name: vector_math
      sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
      url: "https://pub.dev"
    source: hosted
    version: "2.1.4"
  video_player:
    dependency: "direct main"
    description:
      name: video_player
      sha256: e30df0d226c4ef82e2c150ebf6834b3522cf3f654d8e2f9419d376cdc071425d
      url: "https://pub.dev"
    source: hosted
    version: "2.9.1"
  video_player_android:
    dependency: transitive
    description:
      name: video_player_android
      sha256: "38d8fe136c427abdce68b5e8c3c08ea29d7a794b453c7a51b12ecfad4aad9437"
      url: "https://pub.dev"
    source: hosted
    version: "2.7.3"
  video_player_avfoundation:
    dependency: transitive
    description:
      name: video_player_avfoundation
      sha256: d1e9a824f2b324000dc8fb2dcb2a3285b6c1c7c487521c63306cc5b394f68a7c
      url: "https://pub.dev"
    source: hosted
    version: "2.6.1"
  video_player_platform_interface:
    dependency: transitive
    description:
      name: video_player_platform_interface
      sha256: "236454725fafcacf98f0f39af0d7c7ab2ce84762e3b63f2cbb3ef9a7e0550bc6"
      url: "https://pub.dev"
    source: hosted
    version: "6.2.2"
  video_player_web:
    dependency: transitive
    description:
      name: video_player_web
      sha256: "6dcdd298136523eaf7dfc31abaf0dfba9aa8a8dbc96670e87e9d42b6f2caf774"
      url: "https://pub.dev"
    source: hosted
    version: "2.3.2"
  vm_service:
    dependency: transitive
    description:
      name: vm_service
      sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
      url: "https://pub.dev"
    source: hosted
    version: "14.2.5"
  web:
    dependency: transitive
    description:
      name: web
      sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062
      url: "https://pub.dev"
    source: hosted
    version: "1.0.0"
sdks:
  dart: ">=3.5.3 <4.0.0"
  flutter: ">=3.24.0"

```

</details>


### Steps to reproduce

Affected version camera: 0.11
Tested on camera 0.10.6 and no issue.


1. Open flutter page that use camera API using the cached flutter engine.
```
startActivity(
                FlutterActivity
                    .withCachedEngine(MyApplication.FLUTTER_ENGINE_ID)
                    .build(this)
            )
```
2. Close the flutter app
3. Reopen flutter app and recall camera API
4. Camera stops working, and error logs showing.

OR From Demo App

1. Clone the repo  https://github.com/josephmangmang/Camera-Test-Module
2.  cd camera_test_module
3. flutter pub get
4. cd ../CameraTest
5. gradle sync and run
6. Main UI -> Click **Open Camera withCachedEngine** & select any camera front or back
7. Press back button
8. Click again **Open Camera withCachedEngine** & select any camera front or back
9. Check logcat for error


https://github.com/user-attachments/assets/57bfaf5d-6a86-4c33-9525-6cafef1413cc



### Expected results

Camera API should be usable when using cached flutter engine.

### Actual results

Camera API not usable after the first app run.

### Code sample

<details open><summary>Code sample</summary>

I created example app to reproduce the issue [https://github.com/josephmangmang/Camera-Test-Module](https://github.com/josephmangmang/Camera-Test-Module)

</details>


### Screenshots or Videos

<details open>
<summary>Screenshots / Video demonstration</summary>
<img width="1669" alt="Screenshot 2024-09-21 at 7 58 05 PM" src="https://github.com/user-attachments/assets/53b279d3-fa5d-4909-9c5a-c4b96007bc4e">


</details>


### Logs

When using camera api for the first time after app launch and until closing the app
<details open><summary>Logs</summary>

```console

2024-09-21 19:44:12.056  9295-9321  flutter                 com.mt.cameratest                    I  Method channel handler called with method: openCamera
2024-09-21 19:44:12.091  9295-9295  m.mt.camerates          com.mt.cameratest                    W  Accessing hidden method Landroid/view/accessibility/AccessibilityNodeInfo;->getSourceNodeId()J (greylist,test-api, reflection, allowed)
2024-09-21 19:44:12.091  9295-9295  m.mt.camerates          com.mt.cameratest                    W  Accessing hidden method Landroid/view/accessibility/AccessibilityRecord;->getSourceNodeId()J (greylist, reflection, allowed)
2024-09-21 19:44:12.091  9295-9295  m.mt.camerates          com.mt.cameratest                    W  Accessing hidden field Landroid/view/accessibility/AccessibilityNodeInfo;->mChildNodeIds:Landroid/util/LongArray; (greylist, reflection, allowed)
2024-09-21 19:44:12.091  9295-9295  m.mt.camerates          com.mt.cameratest                    W  Accessing hidden method Landroid/util/LongArray;->get(I)J (greylist, reflection, allowed)
2024-09-21 19:44:12.126  9295-9321  flutter                 com.mt.cameratest                    I  Getting available cameras...
2024-09-21 19:44:12.142  9295-9322  HostConnection          com.mt.cameratest                    D  HostConnection::get() New Host Connection established 0xb4000077f51aa650, tid 9322
2024-09-21 19:44:12.143  9295-9322  HostConnection          com.mt.cameratest                    D  HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data ANDROID_EMU_vulkan_async_qsri ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0 
2024-09-21 19:44:12.144  9295-9322  EGL_emulation           com.mt.cameratest                    D  eglMakeCurrent: 0xb4000077e52101b0: ver 3 0 (tinfo 0xb4000077851e55e0) (first time)
2024-09-21 19:44:12.182  9295-9322  EGL_emulation           com.mt.cameratest                    D  eglCreateContext: 0xb4000077e52131d0: maj 3 min 0 rcv 3
2024-09-21 19:44:12.225  9295-9295  m.mt.camerates          com.mt.cameratest                    W  Accessing hidden method Landroid/app/ActivityThread;->currentActivityThread()Landroid/app/ActivityThread; (greylist, linking, allowed)
2024-09-21 19:44:12.225  9295-9295  m.mt.camerates          com.mt.cameratest                    W  Accessing hidden method Landroid/app/ActivityThread;->getActivity(Landroid/os/IBinder;)Landroid/app/Activity; (greylist, linking, allowed)
2024-09-21 19:44:12.225  9295-9351  ProfileInstaller        com.mt.cameratest                    D  Installing profile for com.mt.cameratest
2024-09-21 19:44:12.229  9295-9350  CameraManagerGlobal     com.mt.cameratest                    I  Connecting to camera service
2024-09-21 19:44:12.240  9295-9350  CameraRepository        com.mt.cameratest                    D  Added camera: 0
2024-09-21 19:44:12.246  9295-9350  Camera2CameraInfo       com.mt.cameratest                    I  Device Level: INFO_SUPPORTED_HARDWARE_LEVEL_3
2024-09-21 19:44:12.247  9295-9350  CameraRepository        com.mt.cameratest                    D  Added camera: 1
2024-09-21 19:44:12.248  9295-9350  Camera2CameraInfo       com.mt.cameratest                    I  Device Level: INFO_SUPPORTED_HARDWARE_LEVEL_FULL
2024-09-21 19:44:12.248  9295-9350  CameraValidator         com.mt.cameratest                    D  Verifying camera lens facing on emulator_arm64, lensFacingInteger: null
2024-09-21 19:44:12.312  9295-9295  CameraOrientationUtil   com.mt.cameratest                    D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
2024-09-21 19:44:12.364  9295-9295  CameraOrientationUtil   com.mt.cameratest                    D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=270, isOppositeFacing=false, result=270
2024-09-21 19:44:12.365  9295-9321  flutter                 com.mt.cameratest                    I  Available cameras: [CameraDescription(Camera 0, CameraLensDirection.back, 90), CameraDescription(Camera 1, CameraLensDirection.front, 270)]
2024-09-21 19:44:17.780  9295-9295  CameraOrientationUtil   com.mt.cameratest                    D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
2024-09-21 19:44:17.784  9295-9295  chatty                  com.mt.cameratest                    I  uid=10168(com.mt.cameratest) identical 3 lines
2024-09-21 19:44:17.785  9295-9295  CameraOrientationUtil   com.mt.cameratest                    D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
2024-09-21 19:44:17.785  9295-9295  DynamicRangeResolver    com.mt.cameratest                    D  Resolved dynamic range for use case androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987 to no compatible HDR dynamic ranges.
                                                                                                    DynamicRange@45b6a82{encoding=UNSPECIFIED, bitDepth=0}
                                                                                                    ->
                                                                                                    DynamicRange@34001cd{encoding=SDR, bitDepth=8}
2024-09-21 19:44:17.790  9295-9295  CameraOrientationUtil   com.mt.cameratest                    D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
2024-09-21 19:44:17.790  9295-9295  DeferrableSurface       com.mt.cameratest                    D  Surface created[total_surfaces=1, used_surfaces=0](androidx.camera.core.processing.SurfaceEdge$SettableSurface@559acce}
2024-09-21 19:44:17.791  9295-9295  DeferrableSurface       com.mt.cameratest                    D  Surface created[total_surfaces=2, used_surfaces=0](androidx.camera.core.SurfaceRequest$2@ee7c7da}
2024-09-21 19:44:17.792  9295-9295  DeferrableSurface       com.mt.cameratest                    D  New surface in use[total_surfaces=2, used_surfaces=1](androidx.camera.core.SurfaceRequest$2@ee7c7da}
2024-09-21 19:44:17.792  9295-9295  DeferrableSurface       com.mt.cameratest                    D  use count+1, useCount=1 androidx.camera.core.SurfaceRequest$2@ee7c7da
2024-09-21 19:44:17.792  9295-9295  CameraOrientationUtil   com.mt.cameratest                    D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
2024-09-21 19:44:17.794  9295-9295  ImageCapture            com.mt.cameratest                    D  createPipeline(cameraId: 0, streamSpec: StreamSpec{resolution=640x480, dynamicRange=DynamicRange@34001cd{encoding=SDR, bitDepth=8}, expectedFrameRateRange=[0, 0], implementationOptions=androidx.camera.camera2.impl.Camera2ImplConfig@93485e7})
2024-09-21 19:44:17.797  9295-9295  DeferrableSurface       com.mt.cameratest                    D  Surface created[total_surfaces=3, used_surfaces=1](androidx.camera.core.impl.ImmediateSurface@3d39594}
2024-09-21 19:44:17.799  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Use case androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181 ACTIVE
2024-09-21 19:44:17.799  9295-9295  CameraOrientationUtil   com.mt.cameratest                    D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
2024-09-21 19:44:17.799  9295-9295  CameraOrientationUtil   com.mt.cameratest                    D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
2024-09-21 19:44:17.800  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [] for camera: 0
2024-09-21 19:44:17.800  9295-9295  DeferrableSurface       com.mt.cameratest                    D  Surface created[total_surfaces=4, used_surfaces=1](androidx.camera.core.impl.ImmediateSurface@d477832}
2024-09-21 19:44:17.800  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Use case androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318 ACTIVE
2024-09-21 19:44:17.800  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [] for camera: 0
2024-09-21 19:44:17.800  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Use case androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181 ACTIVE
2024-09-21 19:44:17.800  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [] for camera: 0
2024-09-21 19:44:17.801  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Use case androidx.camera.core.ImageAnalysis-e215b25d-24c3-4a42-9846-c77e238bc8a538523315 INACTIVE
2024-09-21 19:44:17.801  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [] for camera: 0
2024-09-21 19:44:17.801  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [] for camera: 0
2024-09-21 19:44:17.801  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Use cases [androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318, androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181, androidx.camera.core.ImageAnalysis-e215b25d-24c3-4a42-9846-c77e238bc8a538523315] now ATTACHED
2024-09-21 19:44:17.801  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  All use case: [androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181, androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318, androidx.camera.core.ImageAnalysis-e215b25d-24c3-4a42-9846-c77e238bc8a538523315] for camera: 0
2024-09-21 19:44:17.802  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181, androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318] for camera: 0
2024-09-21 19:44:17.803  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Resetting Capture Session
2024-09-21 19:44:17.803  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Releasing session in state INITIALIZED
2024-09-21 19:44:17.803  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Attempting to force open the camera.
2024-09-21 19:44:17.803  9295-9352  CameraStateRegistry     com.mt.cameratest                    D  tryOpenCamera(Camera@4cd9be0[id=0]) [Available Cameras: 1, Already Open: false (Previous state: null)] --> SUCCESS
2024-09-21 19:44:17.803  9295-9352  CameraStateRegistry     com.mt.cameratest                    D  Recalculating open cameras:
                                                                                                    Camera                                       State                 
                                                                                                    -------------------------------------------------------------------
                                                                                                    Camera@4cd9be0[id=0]                         OPENING               
                                                                                                    Camera@294d96a[id=1]                         UNKNOWN               
                                                                                                    -------------------------------------------------------------------
                                                                                                    Open count: 1 (Max allowed: 1)
2024-09-21 19:44:17.804  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Opening camera.
2024-09-21 19:44:17.804  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Transitioning camera internal state: INITIALIZED --> OPENING
2024-09-21 19:44:17.804  9295-9352  CameraStateMachine      com.mt.cameratest                    D  New public camera state CameraState{type=OPENING, error=null} from OPENING and null
2024-09-21 19:44:17.804  9295-9352  CameraStateMachine      com.mt.cameratest                    D  Publishing new public camera state CameraState{type=OPENING, error=null}
2024-09-21 19:44:17.804  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  All use case: [androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181, androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318, androidx.camera.core.ImageAnalysis-e215b25d-24c3-4a42-9846-c77e238bc8a538523315] for camera: 0
2024-09-21 19:44:17.827  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Use case androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318 ACTIVE
2024-09-21 19:44:17.827  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181, androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318] for camera: 0
2024-09-21 19:44:17.828  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Use case androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181 ACTIVE
2024-09-21 19:44:17.828  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181, androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318] for camera: 0
2024-09-21 19:44:17.829  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Use case androidx.camera.core.ImageAnalysis-e215b25d-24c3-4a42-9846-c77e238bc8a538523315 INACTIVE
2024-09-21 19:44:17.829  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181, androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318] for camera: 0
2024-09-21 19:44:17.831  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} CameraDevice.onOpened()
2024-09-21 19:44:17.831  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Transitioning camera internal state: OPENING --> OPENED
2024-09-21 19:44:17.831  9295-9352  CameraStateRegistry     com.mt.cameratest                    D  Recalculating open cameras:
                                                                                                    Camera                                       State                 
                                                                                                    -------------------------------------------------------------------
                                                                                                    Camera@4cd9be0[id=0]                         OPEN                  
                                                                                                    Camera@294d96a[id=1]                         UNKNOWN               
                                                                                                    -------------------------------------------------------------------
                                                                                                    Open count: 1 (Max allowed: 1)
2024-09-21 19:44:17.831  9295-9352  CameraStateMachine      com.mt.cameratest                    D  New public camera state CameraState{type=OPEN, error=null} from OPEN and null
2024-09-21 19:44:17.831  9295-9352  CameraStateMachine      com.mt.cameratest                    D  Publishing new public camera state CameraState{type=OPEN, error=null}
2024-09-21 19:44:17.831  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  All use case: [androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181, androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318, androidx.camera.core.ImageAnalysis-e215b25d-24c3-4a42-9846-c77e238bc8a538523315] for camera: 0
2024-09-21 19:44:17.834  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181, androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318] for camera: 0
2024-09-21 19:44:17.834  9295-9352  SyncCaptureSessionBase  com.mt.cameratest                    D  [androidx.camera.camera2.internal.SynchronizedCaptureSessionBaseImpl@eb2cddb] getSurface...done
2024-09-21 19:44:17.834  9295-9352  CaptureSession          com.mt.cameratest                    D  Opening capture session.
2024-09-21 19:44:17.842  9295-9352  DeferrableSurface       com.mt.cameratest                    D  use count+1, useCount=2 androidx.camera.core.SurfaceRequest$2@ee7c7da
2024-09-21 19:44:17.842  9295-9352  DeferrableSurface       com.mt.cameratest                    D  New surface in use[total_surfaces=4, used_surfaces=2](androidx.camera.core.impl.ImmediateSurface@3d39594}
2024-09-21 19:44:17.842  9295-9352  DeferrableSurface       com.mt.cameratest                    D  use count+1, useCount=1 androidx.camera.core.impl.ImmediateSurface@3d39594
2024-09-21 19:44:17.842  9295-9352  DeferrableSurface       com.mt.cameratest                    D  New surface in use[total_surfaces=4, used_surfaces=3](androidx.camera.core.impl.ImmediateSurface@d477832}
2024-09-21 19:44:17.842  9295-9352  DeferrableSurface       com.mt.cameratest                    D  use count+1, useCount=1 androidx.camera.core.impl.ImmediateSurface@d477832
2024-09-21 19:44:17.847  9295-9352  CaptureSession          com.mt.cameratest                    D  Attempting to send capture request onConfigured
2024-09-21 19:44:17.847  9295-9352  CaptureSession          com.mt.cameratest                    D  Issuing request for session.
2024-09-21 19:44:17.848  9295-9352  Camera2Cap...estBuilder com.mt.cameratest                    D  createCaptureRequest
2024-09-21 19:44:17.850  9295-9352  CaptureSession          com.mt.cameratest                    D  CameraCaptureSession.onConfigured() mState=OPENED
2024-09-21 19:44:17.850  9295-9352  CaptureSession          com.mt.cameratest                    D  CameraCaptureSession.onReady() OPENED
2024-09-21 19:44:17.851  9295-9314  Gralloc4                com.mt.cameratest                    W  allocator 3.x is not supported
2024-09-21 19:44:17.869  9295-9295  CameraOrientationUtil   com.mt.cameratest                    D  getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
2024-09-21 19:44:17.932  9295-9322  ImageReade...ceProducer com.mt.cameratest                    D  ImageTextureEntry can't wait on the fence on Android < 33
2024-09-21 19:44:19.604  9295-9314  BufferQueueProducer     com.mt.cameratest                    E  [ImageReader-640x480f22m5-9295-3](id:244f00000003,api:4,p:365,c:9295) queueBuffer: BufferQueue has been abandoned
2024-09-21 19:44:19.604  9295-9314  BufferQueueProducer     com.mt.cameratest                    E  [ImageReader-640x480f22m5-9295-3](id:244f00000003,api:4,p:365,c:9295) dequeueBuffer: BufferQueue has been abandoned
2024-09-21 19:44:19.635  9295-9295  DeferrableSurface       com.mt.cameratest                    D  surface closed,  useCount=2 closed=true androidx.camera.core.SurfaceRequest$2@ee7c7da
2024-09-21 19:44:19.635  9295-9295  DeferrableSurface       com.mt.cameratest                    D  surface closed,  useCount=0 closed=true androidx.camera.core.processing.SurfaceEdge$SettableSurface@559acce
2024-09-21 19:44:19.636  9295-9295  DeferrableSurface       com.mt.cameratest                    D  Surface terminated[total_surfaces=3, used_surfaces=3](androidx.camera.core.processing.SurfaceEdge$SettableSurface@559acce}
2024-09-21 19:44:19.636  9295-9295  DeferrableSurface       com.mt.cameratest                    D  use count-1,  useCount=1 closed=true androidx.camera.core.SurfaceRequest$2@ee7c7da
2024-09-21 19:44:19.637  9295-9295  ImageCapture            com.mt.cameratest                    D  clearPipeline
2024-09-21 19:44:19.637  9295-9295  DeferrableSurface       com.mt.cameratest                    D  surface closed,  useCount=1 closed=true androidx.camera.core.impl.ImmediateSurface@3d39594
2024-09-21 19:44:19.637  9295-9316  BufferQueueProducer     com.mt.cameratest                    E  [ImageReader-640x480f22m5-9295-3](id:244f00000003,api:4,p:365,c:9295) queueBuffer: BufferQueue has been abandoned
2024-09-21 19:44:19.637  9295-9295  DeferrableSurface       com.mt.cameratest                    D  surface closed,  useCount=1 closed=true androidx.camera.core.impl.ImmediateSurface@d477832
2024-09-21 19:44:19.638  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Use cases [androidx.camera.core.Preview-f94ddeb5-8d97-460a-b6ac-86c9463b5987146535318, androidx.camera.core.ImageCapture-1e3a1cd3-0752-452b-84f7-41153a1fdd4c185043181, androidx.camera.core.ImageAnalysis-e215b25d-24c3-4a42-9846-c77e238bc8a538523315] now DETACHED for camera
2024-09-21 19:44:19.638  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  All use case: [] for camera: 0
2024-09-21 19:44:19.638  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Resetting Capture Session
2024-09-21 19:44:19.638  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Releasing session in state OPENED
2024-09-21 19:44:19.638  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [] for camera: 0
2024-09-21 19:44:19.638  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [] for camera: 0
2024-09-21 19:44:19.639  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Closing camera.
2024-09-21 19:44:19.639  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Transitioning camera internal state: OPENED --> CLOSING
2024-09-21 19:44:19.639  9295-9352  CameraStateRegistry     com.mt.cameratest                    D  Recalculating open cameras:
                                                                                                    Camera                                       State                 
                                                                                                    -------------------------------------------------------------------
                                                                                                    Camera@4cd9be0[id=0]                         CLOSING               
                                                                                                    Camera@294d96a[id=1]                         UNKNOWN               
                                                                                                    -------------------------------------------------------------------
                                                                                                    Open count: 1 (Max allowed: 1)
2024-09-21 19:44:19.639  9295-9352  CameraStateMachine      com.mt.cameratest                    D  New public camera state CameraState{type=CLOSING, error=null} from CLOSING and null
2024-09-21 19:44:19.639  9295-9352  CameraStateMachine      com.mt.cameratest                    D  Publishing new public camera state CameraState{type=CLOSING, error=null}
2024-09-21 19:44:19.639  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Resetting Capture Session
2024-09-21 19:44:19.639  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Releasing session in state CLOSING
2024-09-21 19:44:19.639  9295-9352  CaptureSession          com.mt.cameratest                    D  onSessionFinished()
2024-09-21 19:44:19.671  9295-9314  BufferQueueProducer     com.mt.cameratest                    E  [ImageReader-640x480f22m5-9295-3](id:244f00000003,api:4,p:365,c:9295) queueBuffer: BufferQueue has been abandoned
2024-09-21 19:44:19.704  9295-9352  BufferQueueProducer     com.mt.cameratest                    E  [ImageReader-640x480f22m5-9295-3](id:244f00000003,api:4,p:365,c:9295) cancelBuffer: BufferQueue has been abandoned
2024-09-21 19:44:19.774  9295-9352  UseCaseAttachState      com.mt.cameratest                    D  Active and attached use case: [] for camera: 0
2024-09-21 19:44:19.774  9295-9352  DeferrableSurface       com.mt.cameratest                    D  use count-1,  useCount=0 closed=true androidx.camera.core.SurfaceRequest$2@ee7c7da
2024-09-21 19:44:19.774  9295-9352  DeferrableSurface       com.mt.cameratest                    D  Surface no longer in use[total_surfaces=3, used_surfaces=2](androidx.camera.core.SurfaceRequest$2@ee7c7da}
2024-09-21 19:44:19.774  9295-9352  DeferrableSurface       com.mt.cameratest                    D  Surface terminated[total_surfaces=2, used_surfaces=2](androidx.camera.core.SurfaceRequest$2@ee7c7da}
2024-09-21 19:44:19.774  9295-9352  DeferrableSurface       com.mt.cameratest                    D  use count-1,  useCount=0 closed=true androidx.camera.core.impl.ImmediateSurface@3d39594
2024-09-21 19:44:19.774  9295-9352  DeferrableSurface       com.mt.cameratest                    D  Surface no longer in use[total_surfaces=2, used_surfaces=1](androidx.camera.core.impl.ImmediateSurface@3d39594}
2024-09-21 19:44:19.774  9295-9352  DeferrableSurface       com.mt.cameratest                    D  Surface terminated[total_surfaces=1, used_surfaces=1](androidx.camera.core.impl.ImmediateSurface@3d39594}
2024-09-21 19:44:19.774  9295-9352  DeferrableSurface       com.mt.cameratest                    D  use count-1,  useCount=0 closed=true androidx.camera.core.impl.ImmediateSurface@d477832
2024-09-21 19:44:19.774  9295-9352  DeferrableSurface       com.mt.cameratest                    D  Surface no longer in use[total_surfaces=1, used_surfaces=0](androidx.camera.core.impl.ImmediateSurface@d477832}
2024-09-21 19:44:19.774  9295-9352  DeferrableSurface       com.mt.cameratest                    D  Surface terminated[total_surfaces=0, used_surfaces=0](androidx.camera.core.impl.ImmediateSurface@d477832}
2024-09-21 19:44:19.774  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} CameraDevice.onClosed()
2024-09-21 19:44:19.774  9295-9352  Camera2CameraImpl       com.mt.cameratest                    D  {Camera@4cd9be0[id=0]} Transitioning camera internal state: CLOSING --> INITIALIZED
2024-09-21 19:44:19.775  9295-9352  CameraStateRegistry     com.mt.cameratest                    D  Recalculating open cameras:
                                                                                                    Camera                                       State                 
                                                                                                    -------------------------------------------------------------------
                                                                                                    Camera@4cd9be0[id=0]                         CLOSED                
                                                                                                    Camera@294d96a[id=1]                         UNKNOWN               
                                                                                                    -------------------------------------------------------------------
                                                                                                    Open count: 0 (Max allowed: 1)
2024-09-21 19:44:19.775  9295-9352  CameraStateMachine      com.mt.cameratest                    D  New public camera state CameraState{type=CLOSED, error=null} from CLOSED and null
2024-09-21 19:44:19.775  9295-9352  CameraStateMachine      com.mt.cameratest                    D  Publishing new public camera state CameraState{type=CLOSED, error=null}
2024-09-21 19:44:20.076  9295-9295  ActivityThread          com.mt.cameratest                    E  Activity io.flutter.embedding.android.FlutterActivity has leaked IntentReceiver io.flutter.plugins.camerax.DeviceOrientationManager$1@2348a40 that was originally registered here. Are you missing a call to unregisterReceiver()?
                                                                                                    android.app.IntentReceiverLeaked: Activity io.flutter.embedding.android.FlutterActivity has leaked IntentReceiver io.flutter.plugins.camerax.DeviceOrientationManager$1@2348a40 that was originally registered here. Are you missing a call to unregisterReceiver()?
                                                                                                    	at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1594)
                                                                                                    	at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1374)
                                                                                                    	at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1614)
                                                                                                    	at android.app.ContextImpl.registerReceiver(ContextImpl.java:1580)
                                                                                                    	at android.app.ContextImpl.registerReceiver(ContextImpl.java:1568)
                                                                                                    	at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:668)
                                                                                                    	at io.flutter.plugins.camerax.DeviceOrientationManager.start(DeviceOrientationManager.java:73)
                                                                                                    	at io.flutter.plugins.camerax.DeviceOrientationManagerHostApiImpl.startListeningForDeviceOrientationChange(DeviceOrientationManagerHostApiImpl.java:65)
                                                                                                    	at io.flutter.plugins.camerax.GeneratedCameraXLibrary$DeviceOrientationManagerHostApi.lambda$setup$0(GeneratedCameraXLibrary.java:1606)
                                                                                                    	at io.flutter.plugins.camerax.GeneratedCameraXLibrary$DeviceOrientationManagerHostApi$$ExternalSyntheticLambda0.onMessage(D8$$SyntheticClass:0)
                                                                                                    	at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:261)
                                                                                                    	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
                                                                                                    	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
                                                                                                    	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:938)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loop(Looper.java:223)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7656)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
```

</details>

After the crash and reusing the cached flutter engine and open the flutter app again then app access camera API. 
<details open><summary>Logs</summary>

```console
2024-09-21 19:47:52.274  9295-9321  flutter                 com.mt.cameratest                    I  Method channel handler called with method: openCamera
2024-09-21 19:47:52.340  9295-9321  flutter                 com.mt.cameratest                    I  Getting available cameras...
2024-09-21 19:47:52.443  9295-9321  flutter                 com.mt.cameratest                    E  [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(java.lang.NullPointerException, NullPointerException, Cause: null, Stacktrace: java.lang.NullPointerException
                                                                                                    	at java.util.Objects.requireNonNull(Objects.java:220)
                                                                                                    	at io.flutter.plugins.camerax.ProcessCameraProviderHostApiImpl.getAvailableCameraInfos(ProcessCameraProviderHostApiImpl.java:92)
                                                                                                    	at io.flutter.plugins.camerax.GeneratedCameraXLibrary$ProcessCameraProviderHostApi.lambda$setup$1(GeneratedCameraXLibrary.java:1157)
                                                                                                    	at io.flutter.plugins.camerax.GeneratedCameraXLibrary$ProcessCameraProviderHostApi$$ExternalSyntheticLambda1.onMessage(D8$$SyntheticClass:0)
                                                                                                    	at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:261)
                                                                                                    	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
                                                                                                    	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
                                                                                                    	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:938)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loop(Looper.java:223)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7656)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
                                                                                                    , null)
                                                                                                    #0      ProcessCameraProviderHostApi.getAvailableCameraInfos (package:camera_android_camerax/src/camerax_library.g.dart:681:7)
                                                                                                    <asynchronous suspension>
                                                                                                    #1      ProcessCameraProviderHostApiImpl.getAvailableCameraInfosFromInstances (package:camera_android_camerax/src/process_camera_provider.dart:117:36)
                                                                                                    <asynchronous suspension>
                                                                                                    #2      AndroidCameraCameraX.availableCameras (package:camera_android_camerax/src/android_camera_camerax.dart:271:9)
                                                                                                    <asynchronous suspension>
                                                                                                    #3      _CameraExampleHomeState._getAvailableCamera (package:camera_test_module/camera_example.dart:970:18)
                                                                                                    <asynchronous suspension>
2024-09-21 19:47:56.114  9295-9321  flutter                 com.mt.cameratest                    E  [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(java.lang.NullPointerException, NullPointerException, Cause: null, Stacktrace: java.lang.NullPointerException
                                                                                                    	at java.util.Objects.requireNonNull(Objects.java:220)
                                                                                                    	at io.flutter.plugins.camerax.ProcessCameraProviderHostApiImpl.unbindAll(ProcessCameraProviderHostApiImpl.java:173)
                                                                                                    	at io.flutter.plugins.camerax.GeneratedCameraXLibrary$ProcessCameraProviderHostApi.lambda$setup$5(GeneratedCameraXLibrary.java:1272)
                                                                                                    	at io.flutter.plugins.camerax.GeneratedCameraXLibrary$ProcessCameraProviderHostApi$$ExternalSyntheticLambda5.onMessage(D8$$SyntheticClass:0)
                                                                                                    	at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:261)
                                                                                                    	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
                                                                                                    	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
                                                                                                    	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:938)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loop(Looper.java:223)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7656)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
                                                                                                    , null)
                                                                                                    #0      ProcessCameraProviderHostApi.unbindAll (package:camera_android_camerax/src/camerax_library.g.dart:790:7)
                                                                                                    <asynchronous suspension>
2024-09-21 19:47:56.158  9295-9321  flutter                 com.mt.cameratest                    E  [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'ProcessCameraProvider' is not a subtype of type 'VideoCapture?' in type cast
                                                                                                    #0      InstanceManager.getInstanceWithWeakReference (package:camera_android_camerax/src/instance_manager.dart:121:64)
                                                                                                    #1      VideoCaptureHostApiImpl.withOutputFromInstance (package:camera_android_camerax/src/video_capture.dart:85:10)
                                                                                                    <asynchronous suspension>
                                                                                                    #2      AndroidCameraCameraX.createCameraWithSettings (package:camera_android_camerax/src/android_camera_camerax.dart:386:20)
                                                                                                    <asynchronous suspension>
                                                                                                    #3      CameraController._initializeWithDescription (package:camera/src/camera_controller.dart:344:19)
                                                                                                    <asynchronous suspension>
                                                                                                    #4      _CameraExampleHomeState._initializeCameraController (package:camera_test_module/camera_example.dart:594:7)
                                                                                                    <asynchronous suspension>

```
</details>

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
❯ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.5 23F79 darwin-arm64, locale en-PH)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.93.1)
[✓] Connected device (4 available)
    ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated
      with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!
```

</details>