CameraX overview Part of Android Jetpack.
CameraX is a Jetpack library, built to help make camera app development easier. For new apps, we recommend starting with CameraX. It provides a consistent, easy-to-use API that works across the vast majority of Android devices, with backward-compatibility to Android 5.0 (API level 21).
CameraX improves the developer experience in several key ways.
Broad device compatibility
CameraX supports devices running Android 5.0 (API level 21) and higher, representing over 98% of existing Android devices.
Ease of use
CameraX emphasizes use cases, which allow you to focus on the task you need to get done instead of managing device-specific nuances. Most common camera use cases are supported:
- Preview: View an image on the display.
- Image analysis: Access a buffer seamlessly for use in your algorithms, such as to pass to ML Kit.
- Image capture: Save images.
- Video capture: Save video and audio.
Consistency across devices
Maintaining consistent camera behavior is hard. You have to consider aspect ratio, orientation, rotation, preview size, and image size. With CameraX, these basic behaviors just work.
We maintain an automated CameraX test lab that tests a variety of camera behaviors across a range of devices and all operating system versions since Android 5.0. These tests run on an ongoing basis to identify and fix a wide range of issues.
CameraX has an optional Extensions API that allows you to access the same features and capabilities as a device's native camera app with as few as two lines of code.
Extensions include bokeh (portrait), high dynamic range (HDR), night mode, and face retouching, all of which require device support.
To see how CameraX has simplified development for Monzo, see their case study.
- CameraX architecture
- Configuration options
- Implement a preview
- Image analysis
- Image capture
- Video capture
- Camera extensions
- Transform output
- Use case rotations
- Lab-tested devices
To learn more about CameraX, consult the following additional resources.