What problem does it solve?
This Skill fixes fragile, orientation- and lifecycle-buggy legacy Android camera implementations by migrating Camera1 or raw Camera2 usage to CameraX, which is lifecycle-aware and device-tolerant.
Core Features & Use Cases
- Dependency setup: Adds the correct CameraX artifacts (including Compose support) with appropriate minimum versions.
- Lifecycle-safe binding: Replaces manual camera open/close logic by binding use cases to a
LifecycleOwner via ProcessCameraProvider.
- Reliable preview and capture: Implements
Preview plus ImageCapture, including tap-to-focus and correct rotation handling.
- Front/back switching: Rebinds use cases when changing
CameraSelector for lens-facing toggles.
- Use Case: Migrate an app that currently manages
android.hardware.Camera with custom SurfaceView + orientation matrices into a stable CameraX implementation with preview and photo capture.
Quick Start
Update your legacy Camera1/Camera2 implementation by following the CameraX steps to bind Preview and ImageCapture to your LifecycleOwner, wire PreviewView or CameraXViewfinder, add tap-to-focus, and capture photos without manual lifecycle or rotation handling.