Skip to content

Conversation

@0xfe10
Copy link

@0xfe10 0xfe10 commented Jan 27, 2026

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_camerax as the default Android implementation (in camera 0.11.0), projects using CameraX 1.5.2+ started experiencing compilation failures because the transitive dependency on androidx.concurrent.futures was not explicitly declared.

Changes

  • Added implementation("androidx.concurrent:concurrent-futures:1.2.0") to android/build.gradle dependencies

Testing

  • Verified build succeeds with AGP 8.9.1, Gradle 9.3.0, and compileSdk 35
  • Confirmed no runtime issues with camera functionality

Related Issue

This PR fixes build failures reported by users upgrading to camera 0.11.0+

Pre-Review Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter.
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets: [camera_android_camerax]
  • I linked to at least one issue that this PR fixes in the description above. (No existing issue found - this is a build configuration fix)
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy. (Version bump not required - build dependency fix only)
  • I updated CHANGELOG.md to add a description of the change. (CHANGELOG update not required - internal build dependency fix)
  • I updated/added any relevant documentation (doc comments with ///). (No API changes - documentation not required)
  • I added new tests to check the change I am making. (Test exemption - build dependency fix, no behavioral changes)
  • All existing and new tests are passing.

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.

…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.
@0xfe10 0xfe10 requested a review from camsim99 as a code owner January 27, 2026 01:26
@flutter-dashboard
Copy link

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.

@google-cla
Copy link

google-cla bot commented Jan 27, 2026

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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

@0xfe10
Copy link
Author

0xfe10 commented Jan 27, 2026

I signed the CLA.

@camsim99
Copy link
Contributor

camsim99 commented Jan 30, 2026

@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 flutter doctor -v output so that we can help find what's actually causing the issue?

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
https://groups.google.com/a/android.com/g/camerax-developers/c/exNGG7HvrC8

@stuartmorgan-g
Copy link
Collaborator

Marking as Draft pending completion of the rest of the checklist (especially the issue requested above).

@stuartmorgan-g stuartmorgan-g marked this pull request as draft February 3, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants