Repository navigation
[camera_android_camerax] Update CameraX to 1.7.0 - #13775
shalevmoyal-fs wants to merge 4 commits into
Conversation
82b0215 to
18bdded
Compare
There was a problem hiding this comment.
Code Review
This pull request updates the CameraX dependency from 1.6.2 to 1.7.0, raises the minimum Android SDK version to 24, and adds deprecation suppressions and TODOs across several proxy API classes to facilitate future migration to Camera2Interop V2. The reviewer suggests increasing the minimum Flutter constraint in pubspec.yaml to 3.47.0 to prevent build failures for projects using older Kotlin versions.
| repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax | ||
| issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 | ||
| version: 0.7.6+2 | ||
| version: 0.7.7 |
There was a problem hiding this comment.
Since CameraX 1.7.0 requires Kotlin 2.1.0 or newer, keeping the flutter constraint at >=3.44.0 will cause build failures for apps on Flutter 3.44-3.46 that are still using Kotlin 2.0.x. To prevent these compile-time breakages, it is highly recommended to raise the minimum flutter constraint in pubspec.yaml to >=3.47.0 (which requires Kotlin 2.2.20) rather than relying solely on a CHANGELOG warning. This ensures that the pub dependency solver will correctly prevent older, incompatible Flutter projects from resolving to this version.
…7.0's Kotlin requirement
Bumps
cameraxVersionfrom 1.6.2 to 1.7.0.CameraX 1.7.0 artifacts declare
minSdkVersion24, so this raises the plugin'sminSdkfrom 23 to 24 (and the matching Robolectric@Config(minSdk = ...)inCamera2CameraInfoTest). Per OS version support this should be a no-op for supported clients: Flutter lists Android 23 and earlier as unsupported, this package already requires Flutter >=3.44.0 (defaultminSdkVersion24), and the other Android plugins in this repo are already at 24. One caveat: Flutter 3.44-3.47 only warn on minSdk 23, so an app that pins 23 will now fail the manifest merge. Minor version bump (0.7.7), as in #11441.CameraX 1.7.0 deprecates the Camera2Interop V1 classes (
Camera2CameraControl,Camera2CameraInfo,CaptureRequestOptions,Camera2Interop.Extender). The example app compiles the plugin with-Xlint:all -Werror, so the Java call sites get@SuppressWarnings("deprecation")with a comment. Moving to the V2 API (Camera2Interop.forUseCase()/forCameraControl()etc.) is left for a follow-up: flutter/flutter#197317 (each suppression has a TODO pointing to it). The Pigeon-generatedCameraXLibrary.g.ktnow emits Kotlin deprecation warnings for those three classes; they are warnings only and don't fail the build.Other effects of the bump:
kotlin-stdlib2.2.20, so apps need Kotlin 2.1.0 or newer (before: 2.0.0). A compiler-level check with kotlinc 2.0.21 fails against 1.7.0 and passes against 1.6.2; kotlinc 2.1.21 passes against 1.7.0. Flutter 3.44 apps on Kotlin 2.0.x would be affected (Flutter 3.47.4 already requires 2.2.20). I added a CHANGELOG line; alternatively theflutter:constraint could be raised to >=3.47.0 so those apps can't resolve this version. Which do you prefer?androidx.camera:camera-common:1.7.0; CameraX classes are now Java 11 bytecode.This unblocks #13774, which needs
Recorder.Builder.setVideoMimeTypefrom CameraX 1.7.0.Part of flutter/flutter#83074
Related: flutter/flutter#197317
Test exemption: manual dependency roll with no plugin code or API change. Existing Java unit tests, Dart tests and example APK builds (debug and release) pass. CameraX 1.7.0 itself is exercised on a real device (Samsung Galaxy A05, Android 14) through #13774, which includes this bump: video recording with and without a codec set works there.
Pre-Review Checklist
[shared_preferences]///).🤖 Generated with Claude Code
Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2