https://developer.android.com/agents/skills/camera/camera1-to-camerax/skill
CommunityMigrate Camera to CameraX safely
System Documentation
What problem does it solve?
Camera1 implementations are complex, tied to manual lifecycle handling, and often require brittle orientation and focus logic. This migration guide helps you replace those legacy camera APIs with CameraX components that integrate cleanly with Android lifecycles.
Core Features & Use Cases
- Dependency setup for CameraX: Adds CameraX libraries using a Version Catalog or direct Gradle dependencies, with guidance to use minimum versions for interoperability and Compose extensions.
- Lifecycle-safe camera initialization: Uses
ProcessCameraProviderto bindPreviewandImageCaptureto aLifecycleOwnerinstead of manually opening/closing the camera inonResume/onPause. - Preview and tap-to-focus: Supports both View-based (
PreviewView+startFocusAndMetering) and Compose-based (CameraXViewfinder+ metering via coordinate transforms) tap-to-focus patterns. - Photo capture and rotation handling: Captures via
ImageCapture.takePicture, processesImageProxyrotation degrees, mirrors the front camera output, and ensuresimage.close()is called. - Switching cameras: Reconfigures
CameraSelector(front/back) and re-runs the binding flow.
Quick Start
Ask the AI to migrate my existing Android android.hardware.Camera + SurfaceView code to CameraX with ProcessCameraProvider, Preview, ImageCapture, and tap-to-focus for my UI toolkit (Views or Compose), then provide the exact Kotlin snippets and constraints to follow.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: https://developer.android.com/agents/skills/camera/camera1-to-camerax/skill Download link: https://github.com/fornewid/android-developers-changelog/archive/main.zip#https-developer-android-com-agents-skills-camera-camera1-to-camerax-skill Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.