Repository navigation
Commit 538239f
authored
[camera_android_camerax] Add explicit concurrent-futures dependency (flutter#12373)
`camera_android_camerax`'s Gradle module does not explicitly declare a dependency on `androidx.concurrent:concurrent-futures`. Verified via `androidx.camera:camera-core:1.6.1`'s own Gradle module metadata (`.module` file): `camera-core` declares `androidx.concurrent:concurrent-futures` only on its **runtime** variant (`releaseVariantReleaseRuntimePublication`), not its **api/compile** variant (`releaseVariantReleaseApiPublication`). So when a consumer compiles against `camera-core`, Gradle correctly does not put `concurrent-futures` on the compile classpath — that's not a resolution bug, it's what `camera-core`'s own metadata declares.
However, `camera-core`'s compiled `SurfaceRequest.class` carries a compile-time-retained jspecify `@NonNull` type annotation on a member typed `androidx.concurrent.futures.CallbackToFutureAdapter`. javac needs that class on the compile classpath to fully process the annotation metadata during compilation — even though no `camera_android_camerax` (or `camera-core`) source calls it directly. This is a mismatch in `camera-core`'s own packaging (a type needed at compile time for annotation processing, but declared runtime-only), which the Flutter team can't fix upstream since `camera-core` is owned by the AndroidX/Jetpack team. Declaring the dependency explicitly in `camera_android_camerax` works around it.
Confirmed 100% reproducible on a completely stock, uncustomized `flutter create` app on current stable (3.44.8, default AGP 9.0.1, compileSdk 37):
```
flutter create camera_repro
cd camera_repro
flutter pub add camera
flutter build apk --debug
```
fails every time with:
```
error: Cannot attach type annotations @org.jspecify.annotations.NonNull to
SurfaceRequest.mSurfaceRecreationCompleter: class file for
androidx.concurrent.futures.CallbackToFutureAdapter not found
```
Minimal repro repo (steps + README with root cause): https://github.com/dhc-tech/camera-android-camerax-build-repro
List which issues are fixed by this PR:
Fixes flutter#190505
## Pre-Review Checklist1 parent ed5bd29 commit 538239f
4 files changed
Lines changed: 44 additions & 1 deletion
File tree
- packages/camera/camera_android_camerax
- android
- src/test/java/io/flutter/plugins/camerax
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
1 | 8 | | |
2 | 9 | | |
3 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments