You can check the official doc:
CameraX is an addition to Android Jetpack that makes it easier to add camera capabilities to your app. The library provides a number of compatibility fixes and workarounds to help make the developer experience consistent across many devices.
You can use cameraX to interface with a device’s camera through an abstraction called a use case. The following use cases are currently available:
- Preview: prepares a preview SurfaceTexture
- Image analysis: provides CPU-accessible buffers for analysis, such as for machine learning
- Image capture: captures and saves a photo
Use cases can be combined and active concurrently.
Just add the dependencies:
dependencies {
// CameraX core library
def camerax_version = "1.0.0-alpha01"
implementation "androidx.camera:camera-core:$camerax_version"
// If you want to use Camera2 extensions
implementation "androidx.camera:camera-camera2:$camerax_version"
}
For information on how to use the CameraX library check here.