Repository navigation
Open
Labels
P2Important issues not at the top of the work listplatform-androidAndroid applications specificallyt: gradle"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team
Description
Android builds on master (7728fa1a03, tested with AGP 9.3.1, Gradle 9.5.0, android.newDsl=true, and android.builtInKotlin=true) hit two Gradle configuration-cache issues in the Flutter Gradle Plugin (FGP):
- Execution-time
Task.projectaccess fails strict validation:BaseFlutterTaskHelper.getDependenciesFilescallsbaseFlutterTask.project.files(...)at execution time (BaseFlutterTaskHelper.kt). Debug and release builds pass under the defaultproblems=warnmode, but fail whenproblems=failis set. - Configuration cache is never reused across builds:
<intermediateDir>/flutter_build.dchanges on every build, invalidating the stored configuration-cache entry on the next run.
Both issues were found while reviewing #196465 and are not caused by that PR. Unlike the earlier serialization failures in #192035, task-graph serialization now completes on master, exposing these two remaining issues.
Steps to reproduce
- Create a new project on
master(which defaults to AGP9.3.1and Gradle9.5.0):flutter create cc_repro cd cc_repro - Update
android/gradle.propertiesto replace the template'sfalseflags withtrueand enable the configuration cache:android.newDsl=true android.builtInKotlin=true org.gradle.configuration-cache=true
- Run two consecutive debug (or release) APK builds to check configuration-cache reuse:
flutter build apk --debug flutter build apk --debug
- Run Gradle with strict configuration-cache validation:
(cd android && ./gradlew assembleDebug --configuration-cache --configuration-cache-problems=fail)
Expected results
- Debug and release builds report zero configuration-cache problems, and
--configuration-cache-problems=failsucceeds. - The second build reuses the stored configuration-cache entry when project configuration has not changed.
Actual results
- Execution-time
Task.projectproblem: Gradle reports one unique configuration-cache problem during:app:compileFlutterBuildDebug(and:app:compileFlutterBuildRelease).@OutputFiles fun getDependenciesFiles()in BaseFlutterTask.kt callsBaseFlutterTaskHelper.getDependenciesFiles, which accessesbaseFlutterTask.projectat BaseFlutterTaskHelper.kt. Passing--configuration-cache-problems=fail(ororg.gradle.configuration-cache.problems=fail) fails the build on this problem. - Cache invalidated on every build: Subsequent builds never reuse the configuration cache because
<intermediateDir>/flutter_build.dhas changed. At configuration time,FlutterTask.sourceFilesandFlutterTask.outputFiles(FlutterTask.kt) callFlutterTaskHelper.readDependencies(FlutterTaskHelper.kt). That helper readsflutter_build.dand registers it as a configuration-cache input. During task execution,flutter assemble --depfile <intermediateDir>/flutter_build.d(BaseFlutterTaskHelper.kt) rewritesflutter_build.dviaDepfileService.writeToFile(assemble.dart), invalidating the cache entry.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listplatform-androidAndroid applications specificallyt: gradle"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team
Activity