Submission checklist
Description
What happens
Building an Android app that depends on rive (which pulls in rive_native) fails during the :rive_native:runRiveNativeSetup Gradle task:
sh: dart: command not found
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':rive_native:runRiveNativeSetup'.
> Process 'command 'sh'' finished with non-zero exit value 127
Error: Gradle task assembleDevDebug failed with exit code 1
Environment
rive: 0.14.9 (latest)
rive_native: 0.1.9 (latest)
- Flutter: 3.44.6 (stable), managed via FVM (
.fvm/flutter_sdk symlink)
- Host: macOS (Apple Silicon)
- Trigger: build launched from an IDE (VS Code / Android Studio) and/or via FVM, where the pinned
dart is not on the process PATH.
Root cause
rive_native/android/build.gradle (runRiveNativeSetup) shells out to bare dart and relies on it being on the inherited PATH:
// Use shell to find and execute dart (shell has access to PATH)
if (isWindows) {
executable "cmd"
args "/C", "dart", "run", "rive_native:setup", "--verbose", "-p", "android"
} else {
executable "sh"
args "-c", "dart run rive_native:setup --verbose -p android"
}
That assumption breaks in common setups:
- macOS GUI-launched IDEs (VS Code/Android Studio opened from Dock/Finder) spawn build processes with a minimal
PATH that omits dart entirely.
- FVM / asdf / mise / puro — the correct
dart (matching the SDK driving the build) isn't the one on PATH, if any is.
- CI —
dart frequently isn't on PATH.
It "works on my machine" only when a terminal with dart on PATH happens to spawn the build — and even then it may silently use a different Dart version than the one building the app.
Expected behavior
runRiveNativeSetup should invoke the Dart that ships with the Flutter SDK actually driving the build, not a PATH lookup. Flutter already hands the SDK path to Gradle — the same source of truth Flutter's
own Gradle plugin uses:
flutter.sdk in <app>/android/local.properties (canonical), and
- the
FLUTTER_ROOT environment variable (fallback).
(In flutter_tools/gradle, FlutterPlugin.kt reads FLUTTER_ROOT and flutter.sdk, erroring with "Define location with flutter.sdk in the local.properties file or with a FLUTTER_ROOT environment variable"
— exactly the resolution rive_native should reuse.)
Suggested fix
Resolve the Flutter SDK and call its dart directly instead of shelling out to bare dart:
def flutterRoot = {
def props = new Properties()
def lp = new File(project.rootProject.projectDir, "local.properties")
if (lp.exists()) lp.withInputStream { props.load(it) }
return props.getProperty("flutter.sdk") ?: System.getenv("FLUTTER_ROOT")
}()
def dartExe = isWindows ? "${flutterRoot}\\bin\\dart.bat" : "${flutterRoot}/bin/dart"
executable dartExe
args "run", "rive_native:setup", "--verbose", "-p", "android"
This works for FVM/asdf/mise, CI, and every IDE, removes the PATH dependency, and guarantees the setup runs on the same Dart version as the build.
Current workaround
Prepend the SDK's bin to PATH for the build. For VS Code we add it to each launch.json config:
This shouldn't be necessary, the plugin has enough information to find the right dart itself.
Reproduction steps / code
- Make sure you don't have dart or flutter in your PATH
- Install fvm via
brew install fvm
- Open your app project that has the
rive: ^0.14.9 dependency
- Run
fvm use 3.44.6
- In Vscode set the launch.json settings like so:
{
"name": "Dev",
"program": "lib/main.dart",
"request": "launch",
"type": "dart",
"args": [
"--flavor",
"dev"
],
},
- Then launch the app on an Android device/emulator
Upload your reproduction files / stack trace
No response
Source .riv / .rev file
No response
Screenshots / video
Screenshot 2026-07-20 at 10.30.35.png
Rive Flutter package version
0.14.9
Flutter version
No flutter path so no flutter --version
Device
Android Emulator
OS version
Android 16
Additional context
No response
Submission checklist
riveFlutter packageDescription
What happens
Building an Android app that depends on
rive(which pulls inrive_native) fails during the:rive_native:runRiveNativeSetupGradle task:Environment
rive: 0.14.9 (latest)rive_native: 0.1.9 (latest).fvm/flutter_sdksymlink)dartis not on the processPATH.Root cause
rive_native/android/build.gradle(runRiveNativeSetup) shells out to baredartand relies on it being on the inheritedPATH:That assumption breaks in common setups:
PATHthat omitsdartentirely.dart(matching the SDK driving the build) isn't the one onPATH, if any is.dartfrequently isn't onPATH.It "works on my machine" only when a terminal with
dartonPATHhappens to spawn the build — and even then it may silently use a different Dart version than the one building the app.Expected behavior
runRiveNativeSetupshould invoke the Dart that ships with the Flutter SDK actually driving the build, not aPATHlookup. Flutter already hands the SDK path to Gradle — the same source of truth Flutter'sown Gradle plugin uses:
flutter.sdkin<app>/android/local.properties(canonical), andFLUTTER_ROOTenvironment variable (fallback).(In
flutter_tools/gradle,FlutterPlugin.ktreadsFLUTTER_ROOTandflutter.sdk, erroring with "Define location with flutter.sdk in the local.properties file or with a FLUTTER_ROOT environment variable"— exactly the resolution
rive_nativeshould reuse.)Suggested fix
Resolve the Flutter SDK and call its
dartdirectly instead of shelling out to baredart:This works for FVM/asdf/mise, CI, and every IDE, removes the
PATHdependency, and guarantees the setup runs on the same Dart version as the build.Current workaround
Prepend the SDK's
bintoPATHfor the build. For VS Code we add it to eachlaunch.jsonconfig:This shouldn't be necessary, the plugin has enough information to find the right
dartitself.Reproduction steps / code
brew install fvmrive: ^0.14.9dependencyfvm use 3.44.6Upload your reproduction files / stack trace
No response
Source
.riv/.revfileNo response
Screenshots / video
Screenshot 2026-07-20 at 10.30.35.png
Rive Flutter package version
0.14.9
Flutter version
No flutter path so no flutter --version
Device
Android Emulator
OS version
Android 16
Additional context
No response