원클릭으로
camerax
提供使用 CameraX 进行 Android 相机开发的技术指导。当实现相机功能、处理异步录制生命周期、使用 CameraX 进行底层硬件互操作,或集成 ML Kit 或 Media3 特效时使用。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
提供使用 CameraX 进行 Android 相机开发的技术指导。当实现相机功能、处理异步录制生命周期、使用 CameraX 进行底层硬件互操作,或集成 ML Kit 或 Media3 特效时使用。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
提供基于 Android Credential Manager API 实现已验证邮箱获取的完整工作流。使用此 skill 向 Android 应用集成安全、免 OTP 的邮箱验证流程。该 skill 利用来自 Google 等可信提供商的加密验证凭证,解决注册流程摩擦过大的问题。
提供让应用 UI 适配不同 Android 设备(手机、平板、折叠屏、笔记本、桌面、TV、Auto 和 XR)的说明。涵盖使用 Compose MediaQuery API 处理不同窗口尺寸、指针设备(如鼠标)和文本输入设备(如键盘);使用 Navigation3 Scenes 实现多窗格布局;使用 Compose Grid 和 FlexBox API 实现随目标尺寸变化的自适应 UI 组件(如按钮)和自适应布局(含导航区——nav rails 和 nav bars)。
提供将 Android XML View 迁移到 Jetpack Compose 的结构化工作流。该 skill 详述从规划和依赖设置,到主题和布局迁移、验证及 XML 清理的分步流程。当需要在 Android 项目中把 XML View 迁移到 Jetpack Compose 时使用。它解决将旧版 XML View 的 UI 转换为现代声明式 Compose 组件、同时保持互操作性的问题。
使用此 skill 将 Jetpack Compose Styles API 集成到 Android 项目。引导你升级依赖、设置组件主题、让自定义组件可样式化,以及将现有布局属性迁移到统一样式。迁移自定义设计系统组件、用 Style 属性替换硬编码参数、使用 Modifier.styleable 处理交互状态。
学习如何安装并迁移到 Jetpack Navigation 3,以及如何实现 deep links、多个 backstack、scenes(对话框、底部表、list-detail、two-pane、supporting pane)、条件导航(如已登录导航 vs 匿名导航)、从流程返回结果、与 Hilt/ViewModel/Kotlin/View 互操作集成等功能和模式。
帮助开发者集成、调试和解决 Play Engage SDK 实现问题。当添加 Engage SDK 支持、生成发布代码、将数据类映射到实体,或修复 SDK 相关错误时使用。
| name | camerax |
| description | 提供使用 CameraX 进行 Android 相机开发的技术指导。当实现相机功能、处理异步录制生命周期、使用 CameraX 进行底层硬件互操作,或集成 ML Kit 或 Media3 特效时使用。 |
| license | Complete terms in LICENSE.txt |
| metadata | {"author":"Google LLC","last-updated":"2026-07-07","keywords":["recipe","Android","Camera","Camera1","Camera2","CameraX","migration","Compose","guide","dependencies","PreviewView","CameraXViewfinder","ImageCapture","VideoCapture","ImageAnalysis."]} |
This skill provides procedural guidance and standard patterns for building
camera applications on Android, with a focus on CameraX, including its
Camera2Interop utilities, and Media3 integrations.
Various Android camera and media APIs, especially CameraX VideoCapture, use a
fluent, immutable builder-like pattern where methods return a new instance.
Failing to reassign these results in settings, such as audio, being ignored.
Pattern: Reassignment is required
// WRONG
run {
val pending = recorder.prepareRecording(context, opts)
pending.withAudioEnabled() // This returns a new instance which is ignored
val active = pending.start(exec, listener)
}
// CORRECT
run {
val pending = recorder.prepareRecording(context, opts)
.withAudioEnabled() // Chaining works
val active = pending.start(exec, listener)
}
// ALSO CORRECT
run {
var pending = recorder.prepareRecording(context, opts)
pending = pending.withAudioEnabled() // Reassignment
val active = pending.start(exec, listener)
}
See immutability for a list of affected classes.
When migrating legacy camera codebases to the CameraX Jetpack library:
android.hardware.Camera implementations, surface handling, and manual lifecycles, see the Camera1 migration guide.android.hardware.camera2 implementations, session state callbacks, and interop patterns, see the Camera2 migration guide.For multi-step features that involve multiple files and hardware-level wiring, follow the Structural Blueprinting approach to avoid system timeouts. Such complex features include:
ViewModel state, the controller layer, and the Camera2Interop wiring in the session.Media3Effect or SurfaceProcessor over manual OpenGL pipelines unless absolute performance is required.StreamUseCase optimizations and PowerManager thermal states.FakeCameraConfig, handling asynchronous lifecycles, and validating analysis pipelines.See expert-blueprints for step-by-step guides.
Always use higher-level abstractions instead of low-level manual wiring:
MlKitAnalyzer instead of manual ImageAnalysis.Analyzer.Media3Effect for standard post-processing.ConcurrentCamera APIs for dual-stream setups.See modern-apis for current recommendations.
Adhere to the following Android ecosystem standard patterns when building your camera implementations:
Mockito, especially for multi-step CameraX interfaces like ImageProxy. Build "Fakes" to verify state rather than unreliable implementation details.assertThat over standard JUnit assertions like assertEquals for improved readability.@RunWith for test classes to ensure the CI environment executes them correctly.Icon and Text, use semantics { mergeDescendants = true } to ensure screen readers announce them as a single, coherent unit.Camera apps run on a wide variety of hardware, from mobile phones and foldables to tablets, laptops, and even smart appliances. Have consideration for the specific hardware the app is running on.
isRecording state before attempting to stop or pause. Handle VideoRecordEvent.Start for UI state updates, not just the initial call.CAMERA permission; check for RECORD_AUDIO specifically when enabling audio in VideoCapture.