ProcessException error with brand.dart script - 'flutter pub run flutter_launcher_icons' not found

Alejandro3 days ago

Hello everyone,

I'm trying to white-label the new Flutter version of Traccar Manager using the tool/brand.dart script.

I'm working on a Windows 11 environment with the latest version of Android Studio and the latest version of Flutter (just ran flutter upgrade). The flutter doctor command runs perfectly and shows no issues.

The problem is that the brand.dart script consistently fails at the same point: when trying to generate the icons. This is the exact error I receive (the "El sistema no puede encontrar el archivo especificado" part means "The system cannot find the file specified"):

Unhandled exception:

ProcessException: El sistema no puede encontrar el archivo especificado.

  Command: flutter pub run flutter_launcher_icons
#0      _ProcessImpl._start (dart:io-patch/process_patch.dart:421:33)
#1      Process.start (dart:io-patch/process_patch.dart:42:20)
#2      _run (file:///C:/Users/Alejandro/StudioProjects/traccar-manager/tool/brand.dart:138:30)
#3      _generateIcons (file:///C:/Users/Alejandro/StudioProjects/traccar-manager/tool/brand.dart:38:9)
#4      main (file:///C:/Users/Alejandro/StudioProjects/traccar-manager/tool/brand.dart:14:3)

The strangest part is that the flutter pub get command works perfectly and finishes with "Got dependencies!".

I have tried absolutely everything to fix this, assuming it was a cache issue or a broken project state:

git reset --hard HEAD: To restore any files deleted by a failed attempt.

flutter clean: To clear the build cache.

flutter pub cache repair: To force a repair of the global Dart/Flutter package cache.

dart pub global activate flutter_launcher_icons: To install the tool globally.

Restarting Android Studio and the PC multiple times.

Running the command flutter pub run flutter_launcher_icons manually in the terminal (it fails with the same 'file not found' error).

Nothing has worked. I'm still stuck on the same error. It seems like flutter pub get believes it has installed flutter_launcher_icons, but the system (Windows) or the terminal cannot 'see' or execute it.

As an extra piece of information: if I comment out the await _generateIcons(iconPath); line in the script, the script proceeds but then fails when trying to call keytool (with the same ProcessException: El sistema no puede encontrar el archivo especificado error).

This confirms to me that my Windows environment has a problem executing any sub-process (Process.start) called from Dart, not just flutter_launcher_icons.

Has anyone seen this behavior or have any idea what environment variable or Windows setting could be causing Dart sub-processes to fail this way?

Thank you in advance!