camerax

Implement Android camera features with CameraX, Camera2 interop, and Media3 integrations.

2|Updated Jun 21, 2026
One-click install
npx skills add https://github.com/IsKenKenYa/skills --skill camerax-iskenkenya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: camerax
Source: https://github.com/IsKenKenYa/skills/tree/main/skills/android/camera/camerax
Command: npx skills add https://github.com/IsKenKenYa/skills --skill camerax-iskenkenya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building Android camera apps involves error-prone details: immutable builder APIs that silently drop settings, Camera1/Camera2 migration boilerplate, asynchronous recording lifecycles, and hardware diversity across phones, foldables, Wear OS, and XR devices. This Skill provides procedural guidance and standard patterns to implement camera features correctly. ## Core Features & Use Cases - Migration guides: Step-by-step paths for moving legacy Camera1 or verbose Camera2 codebases to CameraX with ProcessCameraProvider, PreviewView, and CameraXViewfinder. - Feature blueprints: Phased implementation plans for manual controls (ISO, exposure, focus via Camera2Interop), RAW capture, Media3 effects, low-light modes, and ML Kit spatial analysis. - Hardware and edge-case coverage: Guidance for foldables, thermals, Wear OS remote viewfinders, XR passthrough, testing with fakes, and common pitfalls like unclosed ImageProxy instances. - Use Case: When asked to add tap-to-focus and video recording to a Jetpack Compose app, the Skill supplies the correct CameraXViewfinder setup, FocusMeteringAction wiring, and the immutable PendingRecording.withAudioEnabled() reassignment pattern. ## Quick Start Use the camerax skill to migrate my Camera2-based photo capture code to CameraX with Jetpack Compose preview.

Frequently Asked Questions about camerax

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate from Camera2 to CameraX?

Replace CameraDevice and CameraCaptureSession callbacks with ProcessCameraProvider bound to a LifecycleOwner, and swap ImageReader flows for ImageCapture and ImageAnalysis use cases. Use Camera2Interop.Extender when you still need specific CaptureRequest options like manual exposure.

How do I implement tap-to-focus in Jetpack Compose with CameraX?

Use CameraXViewfinder with a SurfaceRequest, transform tap coordinates via CoordinateTransformer, then create a metering point with SurfaceOrientedMeteringPointFactory. Pass it to cameraControl.startFocusAndMetering with a FocusMeteringAction.

Why is audio missing from my CameraX video recording?

PendingRecording.withAudioEnabled returns a new instance that must be reassigned or chained; calling it without reassignment silently drops audio. Also verify the RECORD_AUDIO permission is granted before enabling audio in VideoCapture.

Should I use CameraX or Camera2 for a new Android camera app?

CameraX is recommended for most apps because it manages threads, lifecycles, and device workarounds automatically. Use Camera2Interop for the few hardware controls CameraX does not expose, reserving raw Camera2 for highly specialized pipelines.

How do I test CameraX camera features without real hardware?

Build fake implementations of interfaces like ImageProxy instead of using Mockito, and use FakeAppConfig from androidx.camera:camera-testing to simulate hardware constraints. Combine with Google Truth assertions, explicit RunWith annotations, and IdlingResource for asynchronous initialization.

Does CameraX support foldables and low-light photography?

Yes. Use Jetpack WindowManager FoldingFeature to adapt layouts for tabletop and book postures, and update the ViewPort for coordinate accuracy. For low light, use ExtensionsManager Night mode for stills or enableLowLightBoostAsync for preview and video.