Skip to content

Fix Flutter SDK path resolution for FVM and IDE sync#228

Merged
joachim-quis merged 3 commits intomainfrom
tmp-fix-gradle-sdk-resolution
Apr 8, 2026
Merged

Fix Flutter SDK path resolution for FVM and IDE sync#228
joachim-quis merged 3 commits intomainfrom
tmp-fix-gradle-sdk-resolution

Conversation

@joachim-quis
Copy link
Copy Markdown
Contributor

Summary

  • Fix build.gradle Flutter SDK resolution that broke under FVM setups and IDE Gradle sync
  • Walk up directory tree to find local.properties instead of assuming rootProject.projectDir
  • Support -Pflutter.sdk=<path> Gradle property override as highest priority
  • Fall back to FLUTTER_ROOT env var when properties file isn't found

Test plan

  • All 42 Dart unit tests pass
  • Android Kotlin tests pass (Gradle test task)
  • Debug APK builds successfully
  • Standard Flutter setup (non-FVM) verified working

🤖 Generated with Claude Code

The plugin's build.gradle assumed local.properties was always in
rootProject.projectDir, which breaks under FVM setups and certain IDE
sync scenarios where the working directory differs.

Resolution now:
1. Checks the flutter.sdk Gradle property (supports -Pflutter.sdk=<path>)
2. Walks up from project dir looking for local.properties
3. Falls back to FLUTTER_ROOT environment variable

This makes the plugin build reliably across normal Flutter, FVM, and
IDE-triggered Gradle sync without requiring user workarounds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
joachim-quis and others added 2 commits April 5, 2026 08:23
…ibility

When the plugin is resolved from ~/.pub-cache, walking up from
project.projectDir cannot reach the host app's local.properties.
Add rootProject.projectDir lookup and support for the flutter-root
Gradle property (passed by Flutter tooling during builds) to cover
this case.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@joachim-quis joachim-quis merged commit 42919c1 into main Apr 8, 2026
@joachim-quis joachim-quis deleted the tmp-fix-gradle-sdk-resolution branch April 8, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant