camera1-to-camerax

Migrates Android apps from Camera1/Camera2 APIs to CameraX Jetpack library.

Updated Jul 6, 2026
One-click install
npx skills add https://github.com/shirulot/codex-skill --skill camera1-to-camerax-shirulot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: camera1-to-camerax
Source: https://github.com/shirulot/codex-skill/tree/main/camera1-to-camerax
Command: npx skills add https://github.com/shirulot/codex-skill --skill camera1-to-camerax-shirulot

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the complexity and instability of legacy Android camera implementations by providing a structured migration path to the modern, lifecycle-aware CameraX Jetpack library.

Core Features & Use Cases

  • Lifecycle Integration: Automatically binds camera operations to Android lifecycles to prevent memory leaks and crashes.
  • Cross-Device Compatibility: Resolves common issues with device-specific camera rotations and hardware dependencies.
  • Use Case: Use this skill when refactoring an aging application that currently uses the deprecated Camera1 or raw Camera2 APIs to ensure it supports modern Android standards and Jetpack Compose.

Quick Start

Use the camera1-to-camerax skill to guide the migration of my current Camera1 implementation to the CameraX lifecycle-aware architecture.

Frequently Asked Questions about camera1-to-camerax

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

FAQPage Schema
How do I migrate Android Camera1 code to CameraX?

Migrating Android Camera1 code to CameraX involves replacing deprecated API calls with lifecycle-aware components like PreviewView and ImageCapture. This transition ensures proper lifecycle binding to prevent memory leaks and resolves device-specific camera rotation issues.

Does CameraX work with Jetpack Compose?

Yes, CameraX works with Jetpack Compose. The migration facilitates proper integration of PreviewView, ImageCapture, and tap-to-focus functionality within both XML and Jetpack Compose environments, ensuring modern Android architecture compatibility.

What is the best way to transition from raw Camera2 APIs to a lifecycle-aware camera architecture?

The best way to transition from raw Camera2 APIs is adopting the modern CameraX Jetpack library. This approach abstracts device-specific hardware dependencies and automatically binds camera operations to Android lifecycles to prevent crashes.

Why does my legacy Android camera implementation crash on different devices?

Legacy Android camera implementations often crash due to device-specific camera rotations and hardware dependencies. Migrating to the device-agnostic CameraX Jetpack library resolves these common instability issues by abstracting hardware variations.

Can I use CameraX to add tap-to-focus functionality during a Camera1 migration?

Yes, you can integrate tap-to-focus functionality when migrating from Camera1. The CameraX architecture supports proper integration of PreviewView and ImageCapture, enabling modern features like tap-to-focus within XML and Compose environments.