Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

camerax_repro

Minimal reproduction for build failure in camera_android_camerax when using Gradle 9.x.

Related: flutter/packages#10906


Environment

Version
Flutter 3.41.4 (stable)
camera 0.11.3
camera_android_camerax 0.6.30 (camera-core:1.5.3)
AGP 8.9.1
Gradle 9.3.0
compileSdk 35
Java 17

Steps to Reproduce

git clone https://github.com/justshowcode/flutter_packages_camerax_repro
cd flutter_packages_camerax_repro
flutter pub get
cd android && ./gradlew assembleDebug

No code changes needed — just clone and run.


Result Without Fix

Running ./gradlew assembleDebug with the stock camera_android_camerax:0.6.30:

> Task :camera_android_camerax:compileDebugJavaWithJavac FAILED

/root/.gradle/caches/9.3.0/transforms/.../camera-core-1.5.3-api.jar
  (/androidx/camera/core/SurfaceRequest.class):
  error: Cannot attach type annotations @org.jspecify.annotations.NonNull
    to SurfaceRequest.mSurfaceRecreationCompleter:
  class file for androidx.concurrent.futures.CallbackToFutureAdapter not found

FAILURE: Build failed with an exception.

BUILD FAILED in 1m 5s

Fix

Add the missing dependency to camera_android_camerax/android/build.gradle:

dependencies {
    def camerax_version = "1.5.3"
    implementation("androidx.camera:camera-core:${camerax_version}")
+   implementation("androidx.concurrent:concurrent-futures:1.2.0")
    // ...
}

Result With Fix

BUILD SUCCESSFUL in 44s
111 actionable tasks: 60 executed, 51 up-to-date

Root Cause

The Maven POM for camera-core:1.5.3 declares concurrent-futures as runtime scope:

<!-- https://dl.google.com/dl/android/maven2/androidx/camera/camera-core/1.5.3/camera-core-1.5.3.pom -->
<dependency>
  <groupId>androidx.concurrent</groupId>
  <artifactId>concurrent-futures</artifactId>
  <version>1.1.0</version>
  <scope>runtime</scope>
</dependency>

runtime scope means the dependency is not on the compile classpath.

  • Gradle 8.x — promotes transitive runtime dependencies onto the compile classpath, so the build passes
  • Gradle 9.x — enforces strict classpath isolation, no longer does this promotion, so CallbackToFutureAdapter is invisible to the compiler

The explicit implementation declaration fixes this by ensuring Gradle 9.x places concurrent-futures on the compile classpath. It does not introduce any new dependency — it was already pulled in transitively by camera-core.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages