camera viewfinder
This table lists all the artifacts in the androidx.camera-viewfinder group.
| Artifact | Stable Release | Release Candidate | Beta Release | Alpha Release |
|---|---|---|---|---|
| viewfinder-compose | 1.5.1 | - | - | 1.6.0-alpha01 |
| viewfinder-core | 1.5.1 | - | - | 1.6.0-alpha01 |
| viewfinder-view | 1.5.1 | - | - | 1.6.0-alpha01 |
Declaring dependencies
To add a dependency on camera-viewfinder, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.
Add the dependencies for the artifacts you need in the build.gradle file for
your app or module:
Groovy
dependencies { // Use to implement camera viewfinders implementation "androidx.camera.viewfinder:viewfinder-view:1.6.0-alpha01" implementation "androidx.camera.viewfinder:viewfinder-compose:1.6.0-alpha01" implementation "androidx.camera.viewfinder:viewfinder-core:1.6.0-alpha01" }
Kotlin
dependencies { // Use to implement camera viewfinders implementation("androidx.camera.viewfinder:viewfinder-view:1.6.0-alpha01") implementation("androidx.camera.viewfinder:viewfinder-core:1.6.0-alpha01") implementation("androidx.camera.viewfinder:viewfinder-compose:1.6.0-alpha01") }
For more information about dependencies, see Add build dependencies.
Feedback
Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.
See the Issue Tracker documentation for more information.
Version 1.6
Version 1.6.0-alpha01
October 22, 2025
androidx.camera.viewfinder:viewfinder-compose:1.6.0-alpha01, androidx.camera.viewfinder:viewfinder-core:1.6.0-alpha01, and androidx.camera.viewfinder:viewfinder-view:1.6.0-alpha01 are released. Version 1.6.0-alpha01 contains these commits.
API Changes
- Exposed the default viewfinder
ImplementationModevia the newViewfinderDefaults.implementationModepublic API. This is now used as the default for bothViewfinderViewand theViewfindercomposable. (Ic3f52)
Version 1.5
Version 1.5.1
October 08, 2025
androidx.camera.viewfinder:viewfinder-compose:1.5.1, androidx.camera.viewfinder:viewfinder-core:1.5.1, and androidx.camera.viewfinder:viewfinder-view:1.5.1 are released. Version 1.5.1 contains these commits.
Version 1.5.0
September 10, 2025
androidx.camera.viewfinder:viewfinder-compose:1.5.0, androidx.camera.viewfinder:viewfinder-core:1.5.0, and androidx.camera.viewfinder:viewfinder-view:1.5.0 are released. Version 1.5.0 contains these commits.
Important changes since 1.4.0:
This is the first stable release of the Camera Viewfinder library, providing robust, lifecycle-aware, and easy-to-use View and Compose-based APIs. These components are designed to serve as a camera viewfinder and can be integrated directly with Camera2.
This release also establishes the foundation for the new androidx.camera:camera-compose artifact, which introduces CameraXViewfinder, a Compose-idiomatic viewfinder that integrates seamlessly with CameraX SurfaceRequests, similar to how PreviewView works for View-based layouts. Some of the most important changes include:
- Artifact Relocation: To improve modularity, the Viewfinder artifacts have been moved to their own library group. Developers previously using
androidx.camera:camera-viewfinder*dependencies should migrate toandroidx.camera.viewfinder:viewfinder-*. - API Stabilization and Refinements: The API surface has been polished for this stable release. This includes renaming
CameraViewfindertoViewfinderViewto better reflect its versatility, reorganizing packages for clarity, and makingViewfinderSurfaceRequestan immutable data type for more predictable state management. - Compose API Updates: The Compose
ViewfinderAPI now supportsContentScaleandAlignmentfor fine-grained control over how the camera stream is displayed within its container, mirroring the behavior of the standardandroidx.compose.foundation.Imagecomposable. - Surface Lifecycle Management:
ViewfinderSurfaceSessionis now kept alive across configuration changes and lifecycle events on API 29+. This change is designed to reduce dropped frames and provide a smoother user experience. - Implementation Mode Defaults: The
Viewfindernow defaults to an intelligentImplementationModethat automatically selects the best underlying implementation. It prioritizes the high-performanceSurfaceView(EXTERNALmode) and gracefully falls back to the more compatibleTextureView(EMBEDDEDmode) on older API levels or devices with known compatibility issues. This behavior can still be overridden for full developer control.
Bug Fixes
- The composable
Viewfindernow works correctly within Compose'sPagerand withmovableContentOf(), ensuring the surface is properly reset and managed in complex UI scenarios. (I0d9be, I79432) - Fixed an issue on Android 10 and 11 where the
SurfaceView-basedViewfindercould appear stretched when transformations were applied. (Icc77c)
Version 1.5.0-rc01
August 13, 2025
androidx.camera.viewfinder:viewfinder-compose:1.5.0-rc01, androidx.camera.viewfinder:viewfinder-core:1.5.0-rc01, and androidx.camera.viewfinder:viewfinder-view:1.5.0-rc01 are released. Version 1.5.0-rc01 contains these commits.
Bug Fixes
- Moving the default
minSdkfrom API 21 to API 23 (Ibdfca, b/380448311, b/435705964, b/435705223)
Version 1.5.0-beta03
July 16, 2025
androidx.camera.viewfinder:viewfinder-compose:1.5.0-beta03, androidx.camera.viewfinder:viewfinder-core:1.5.0-beta03, and androidx.camera.viewfinder:viewfinder-view:1.5.0-beta03 are released. Version 1.5.0-beta03 contains these commits.
Bug Fixes
- The default
ImplementationModeforViewfinder(both Compose and View-based) now intelligently selects betweenEXTERNAL(for performance) andEMBEDDED(for compatibility on older APIs/quirky devices). This behavior can still be overridden by explicit settings inViewfinderSurfaceRequestor XML attributes (on the View-based API). (Iecd3a) - Improved Surface session management by allowing the
ViewfinderSurfaceSessionto be kept alive across surface create/destroy lifecycles when using TextureView or SurfaceView on API 29+. (I112d9) - The
Viewfindernow ensures Surfaces are released at the proper time, only when no longer in use by the session, rather than always releasing when the Composable is disposed. ForEXTERNAL(SurfaceView) this behavior is currently only available on API 29+. ForEMBEDDED(TextureView), this behavior is present on all API levels. (I9a03f) - The
Viewfindernow properly handles surface replacement in scenarios such as when anEXTERNALviewfinder on API level 28 or lower moves off screen or if aViewfinder(with anyImplementationMode) is part ofmoveableContentOf(). (I79432) - Composable
Viewfindernow works correctly with Compose'sPager. This change ensures that the Composable can be successfully reset by implementing theonResetcallback ofAndroidView, supporting bothEMBEDDEDandEXTERNALimplementations. (I0d9be) - Fixes an issue on Android 10/11 where the
EXTERNALViewfindercould appear stretched or incorrect due to transformation operations (like scale or translate) being applied too early. The system now waits for the Surface to be created before applying these transformations in the layout phase, ensuring correct output. (Icc77c)
Version 1.5.0-beta02
June 4, 2025
androidx.camera.viewfinder:viewfinder-compose:1.5.0-beta02, androidx.camera.viewfinder:viewfinder-core:1.5.0-beta02, and androidx.camera.viewfinder:viewfinder-view:1.5.0-beta02 are released. Version 1.5.0-beta02 contains these commits.
Version 1.5.0-beta01
May 7, 2025
androidx.camera.viewfinder:viewfinder-compose:1.5.0-beta01, androidx.camera.viewfinder:viewfinder-core:1.5.0-beta01, and androidx.camera.viewfinder:viewfinder-view:1.5.0-beta01 are released. Version 1.5.0-beta01 contains these commits.
- This is the first official beta release of the view-based and compose-based viewfinders that are flexible enough to be used with Camera2. If you’re looking for a View or composable to use with CameraX, see
PreviewViewandCameraXViewfinder.
New Features
ContentScaleandAlignmentcan now be used in the compose-based viewfinder to scale and place the displayed surface within its container, similar to howandroidx.compose.foundation.Imagebehaves. (Ibcea3)
API Changes
TransformationInfonow has default values for all args. This will allow Viewfinders to be created without anyTransformationInfo, which will default to a source rotation of 0, no source mirroring, and no crop rect. (I2b1b2)- Composable Viewfinder now takes a trailing lambda to receive a Surface session, similar to
AndroidExternalSurface. The provided lambda usesViewfinderInitScopeas a receiver, which allows installing a callback to receive new Surface sessions. These surface sessions automatically release resources held by the Viewfinder when they go out of scope. (Ib2b0d) ViewfinderSurfaceRequest.Builder.populateFromCharacteristicshas now been removed and is now replaced with an equivalent set of static APIs that can be used to generateTransformationInfowhich will produce the same transformation aspopulateFromCharacteristics. These static methods are added to theCamera2TransformationInfoclass. (Idc6af)ViewfinderSurfaceRequestno longer includes async APIs for retrieving the surface. It is now an immutable data type. APIs for retrieving the Surface are now moved to the viewfinder. (I30127)CameraViewfinderhas been renamed toViewfinderViewso that the naming aligns with the naming of the Viewfinder composable and to indicate that it can be used with more than just camera sources. (Id9e6b)- Classes from
viewfinder-viewhave been moved to theandroidx.camera.viewfinder.viewsubpackage from theandroidx.camera.viewfinderpackage. (I6cb44) - New APIs are added to view-based Viewfinder that allow setting the source rotation, mirroring, and crop rectangle. This
TransformationInfoclass is the same class used by the compose-based Viewfinder. (I907c3) - The view-based Viewfinder now uses new
ViewfinderSurfaceRequestAPIs which no longer internally handle the Surface response. Instead of returningListenableFuture<Surface>, therequestSurfaceSession()APIs now returnListenableFuture<ViewfinderSurfaceSession>which returns anAutoCloseableclass that when closed behaves the same way as calling the old API ofViewfinderSurfaceRequest.markSurfaceSafeToRelease(). This provides a clearer separation of responsibilities between the surface request and surface response. (I19041)
Version 1.4
Version 1.4.0-alpha13
February 26, 2025
androidx.camera.viewfinder:viewfinder-compose:1.4.0-alpha13, androidx.camera.viewfinder:viewfinder-core:1.4.0-alpha13, and androidx.camera.viewfinder:viewfinder-view:1.4.0-alpha13 are released. Version 1.4.0-alpha13 contains these commits.
Version 1.4.0-alpha12
January 15, 2025
androidx.camera.viewfinder:viewfinder-compose:1.4.0-alpha12, androidx.camera.viewfinder:viewfinder-core:1.4.0-alpha12, and androidx.camera.viewfinder:viewfinder-view:1.4.0-alpha12 are released. Version 1.4.0-alpha12 contains these commits.
New Features
- Upgraded
compileSdkas 35 for using Android 15 related API. Apps using CameraX libraries will also need to upgrade theircompileSdkconfig setting. (Ic80cd) - This library now uses JSpecify nullness annotations, which are type-use. Kotlin developers should use the following compiler argument to enforce correct usage:
-Xjspecify-annotations=strict(this is the default starting with version 2.1.0 of the Kotlin compiler). (I7bcd7, b/326456246)
Version 1.4.0-alpha11
December 11, 2024
androidx.camera.viewfinder:viewfinder-compose:1.4.0-alpha11, androidx.camera.viewfinder:viewfinder-core:1.4.0-alpha11, and androidx.camera.viewfinder:viewfinder-view:1.4.0-alpha11 are released. Version 1.4.0-alpha11 contains these commits.
API Changes
viewfinder-coreclasses have been moved into packages that are consistent with the library they belong to. (I431c6)CameraViewfinder.ScaleTypehas been moved toviewfinder-coreso it can be reused with compose (I87ef1)- Deprecated
CameraViewfinderclasses are removed. Please use the new APIs which provide equivalent functionality. (I6e59a)
Version 1.4.0-alpha10
October 30, 2024
androidx.camera.viewfinder:viewfinder-compose:1.4.0-alpha10, androidx.camera.viewfinder:viewfinder-core:1.4.0-alpha10, and androidx.camera.viewfinder:viewfinder-view:1.4.0-alpha10 are released. Version 1.4.0-alpha10 contains these commits.
Version 1.4.0-alpha09
October 2, 2024
androidx.camera.viewfinder:viewfinder-compose:1.4.0-alpha09, androidx.camera.viewfinder:viewfinder-core:1.4.0-alpha09, and androidx.camera.viewfinder:viewfinder-view:1.4.0-alpha09 are released. Version 1.4.0-alpha09 contains these commits.
Version 1.4.0-alpha08
September 4, 2024
androidx.camera.viewfinder:viewfinder-compose:1.4.0-alpha08, androidx.camera.viewfinder:viewfinder-core:1.4.0-alpha08, and androidx.camera.viewfinder:viewfinder-view:1.4.0-alpha08 are released. Version 1.4.0-alpha08 contains these commits.
New Features
With the update to 1.4.0-alpha08, the CameraX Viewfinder artifact has been moved to its own library group. This change is necessary to improve the modularity and maintainability of the CameraX library.
If you were previously depending on androidx.camera:camera-viewfinder, androidx.camera:camera-viewfinder-compose or androidx.camera:camera-viewfinder-core, you will need to transition your dependencies to the following:
androidx.camera:camera-viewfinder->androidx.camera.viewfinder:viewfinder-viewandroidx.camera:camera-viewfinder-compose->androidx.camera.viewfinder:viewfinder-composeandroidx.camera:camera-viewfinder-core->androidx.camera.viewfinder:viewfinder-core
No code changes should be needed to make this transition. The old Viewfinder maven coordinates will no longer receive updates.
Additionally, if you are using Compose with CameraX, a new Compose-first library is now available in alpha: androidx.camera:camera-compose. This provides the CameraXViewfinder composable, which is a compose-idiomatic Viewfinder that adapts CameraX’s SurfaceRequest to Compose, similar to how PreviewView works for views.