Flutter "Flutter SDK not found" in CI
The Flutter SDK is not installed on the runner, or it is installed but not on PATH. Either way the toolchain that drives the build is missing.
What this error means
A step fails with "flutter: command not found" or the Android Gradle build reports "Flutter SDK not found. Define location with flutter.sdk in local.properties". Nothing builds because the SDK is absent.
Flutter SDK not found. Define location with flutter.sdk in the
local.properties file.
# or
./scripts/build.sh: line 2: flutter: command not foundCommon causes
Flutter not installed on the runner
A bare runner image does not ship Flutter. Without a setup step, no flutter binary exists.
SDK present but not on PATH or in local.properties
Flutter was downloaded but its bin is not on PATH, or the Android build cannot find flutter.sdk in android/local.properties.
How to fix it
Install Flutter with the setup action
Use the maintained setup action so PATH and the SDK are configured for you.
- uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: '3.24.0'
- run: flutter --versionPut Flutter on PATH manually
If you install Flutter yourself, export its bin directory for later steps.
git clone https://github.com/flutter/flutter.git -b stable --depth 1
echo "$PWD/flutter/bin" >> "$GITHUB_PATH"
flutter precacheHow to prevent it
- Use a Flutter setup action and pin the version.
- Cache the Flutter SDK and pub cache keyed on your lockfile.
- Run
flutter doctorearly to confirm the toolchain is present.