-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix(camera_android_camerax): Add missing androidx.concurrent:concurrent-futures dependency #10906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(camera_android_camerax): Add missing androidx.concurrent:concurrent-futures dependency #10906
Conversation
…nt-futures dependency Fixes build failure when compiling with CameraX 1.5.2: error: Cannot attach type annotations @org.jspecify.annotations.NonNull class file for androidx.concurrent.futures.CallbackToFutureAdapter not found The androidx.camera:camera-core:1.5.2 library internally uses CallbackToFutureAdapter from androidx.concurrent.futures, but this dependency was not explicitly declared in build.gradle. This fix adds the missing androidx.concurrent:concurrent-futures:1.2.0 dependency to resolve the compilation error.
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request addresses a critical build failure by adding the missing androidx.concurrent:concurrent-futures dependency. This change directly resolves the compilation error encountered when using CameraX 1.5.2+, ensuring the project builds successfully. The added dependency is correctly specified with version 1.2.0, which aligns with the described fix. The change is minimal, targeted, and effectively resolves the reported issue without introducing new complexities.
|
I signed the CLA. |
|
@0xfe10 Thanks for going ahead and trying to fix the issue! However, the camera plugin example app runs fine without this dependency so I'm not sure that this is a solution that the plugin needs (though probably in a different environment--Gradle version, Java version, etc.). Do you mind filing an issue for this instead with a minimal repro and your Also just want to note some places I found people running into similar issues for later reference: https://stackoverflow.com/questions/79835452/i-am-getting-this-error-when-i-add-camera-plug-in |
|
Marking as Draft pending completion of the rest of the checklist (especially the issue requested above). |
Description
Fixes build failure when compiling with CameraX 1.5.2:
error: Cannot attach type annotations @org.jspecify.annotations.NonNull
class file for androidx.concurrent.futures.CallbackToFutureAdapter not found
The androidx.camera:camera-core:1.5.2 library internally uses CallbackToFutureAdapter from androidx.concurrent.futures, but this dependency was not explicitly declared in build.gradle.
This fix adds the missing androidx.concurrent:concurrent-futures:1.2.0 dependency to resolve the compilation error.
Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.
List which issues are fixed by this PR. You must list at least one issue.
Root Cause
When camera plugin upgraded to use
camera_android_cameraxas the default Android implementation (in camera 0.11.0), projects using CameraX 1.5.2+ started experiencing compilation failures because the transitive dependency onandroidx.concurrent.futureswas not explicitly declared.Changes
implementation("androidx.concurrent:concurrent-futures:1.2.0")toandroid/build.gradledependenciesTesting
Related Issue
This PR fixes build failures reported by users upgrading to camera 0.11.0+
Pre-Review Checklist
[camera_android_camerax]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy. (Version bump not required - build dependency fix only)CHANGELOG.mdto add a description of the change. (CHANGELOG update not required - internal build dependency fix)///). (No API changes - documentation not required)Exemption Justification: This PR only adds a missing build dependency declaration that should have been present. It does not change any API, behavior, or user-facing functionality. The dependency was already being used transitively but not explicitly declared, causing build failures in certain configurations.