[linux crash] “Exception: Build process failed” when running apps on stable, that were created on dev

After yesterday’s v2.0.0 release, I tried switching to stable and running my existing Linux app. It would seem that all apps created on dev crash on stable and running flutter create . after switching to stable doesn’t help. This way desktop on stable cannot be used for anything other than creating new apps.

Steps to Reproduce

  1. flutter channel dev
  2. flutter create dev_app && cd dev_app
  3. flutter run -d linux (works)
  4. flutter channel stable
  5. flutter run -d linux (doesn’t work, flutter create . doesn’t help)

Expected results: Application runs

Actual results:

Launching lib/main.dart on Linux in debug mode...
Building Linux application...                                           
Exception: Build process failed
Logs
  • flutter run -v -d linux on stable
...
/home/sandro/snap/flutter/common/flutter/packages/flutter_tools/bin/tool_backend.sh Debug
[        ] Unhandled exception:
[        ] RangeError (index): Invalid value: Only valid value is 0: 1
[        ] #0      List.[] (dart:core-patch/array.dart:110:52)
[        ] #1      main
(file:///home/sandro/snap/flutter/common/flutter/packages/flutter_tools/bin/tool_backend.dart:14:37)
[        ] #2      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:281:32)
[        ] #3      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
[        ] ninja: build stopped: subcommand failed.
[  +13 ms] Building Linux application... (completed in 1,149ms)
[+9747 ms] Exception: Build process failed
[   +1 ms] "flutter run" took 11,515ms.
[   +3 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:644:9)
           <asynchronous suspension>
           #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1157:12)
           <asynchronous suspension>
           #3      FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart:1009:27)
           <asynchronous suspension>
           #4      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #5      AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:197:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:278:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #9      AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
           <asynchronous suspension>
           #10     FlutterCommandRunner.runCommand
(package:flutter_tools/src/runner/flutter_command_runner.dart:234:5)
           <asynchronous suspension>
           #11     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
           <asynchronous suspension>
           #12     run.<anonymous closure> (package:flutter_tools/runner.dart:62:12)
           <asynchronous suspension>
           #13     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #14     AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
           <asynchronous suspension>
           #15     runInContext (package:flutter_tools/src/context_runner.dart:73:10)
           <asynchronous suspension>
           #16     main (package:flutter_tools/executable.dart:90:3)
           <asynchronous suspension>
           
           
[  +59 ms] ensureAnalyticsSent: 57ms
[   +2 ms] Running shutdown hooks
[        ] Shutdown hook priority 4
[  +13 ms] Shutdown hooks complete
[        ] exiting with code 1
  • flutter doctor -v on dev
[✓] Flutter (Channel dev, 2.1.0-10.0.pre, on Linux, locale en_US.UTF-8)
    • Flutter version 2.1.0-10.0.pre at /home/sandro/snap/flutter/common/flutter
    • Framework revision cc9b78fc5c (7 days ago), 2021-02-25 13:26:03 -0800
    • Engine revision a252ec09b7
    • Dart version 2.13.0 (build 2.13.0-77.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /home/sandro/Development/Android/Sdk
    • Platform android-30, build-tools 29.0.2
    • ANDROID_HOME = /home/sandro/Development/Android/Sdk
    • Java binary at: /home/sandro/Development/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[✓] Android Studio (version 3.5)
    • Android Studio at /home/sandro/Development/android-studio
    • Flutter plugin version 41.0.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.53.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.20.0

[✓] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 9 (API 28) (emulator)
    • Linux (desktop)                    • linux         • linux-x64      • Linux
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 88.0.4324.182

• No issues found!
  • flutter doctor -v on stable
✓] Flutter (Channel stable, 2.0.0, on Linux, locale en_US.UTF-8)
    • Flutter version 2.0.0 at /home/sandro/snap/flutter/common/flutter
    • Framework revision 60bd88df91 (18 hours ago), 2021-03-03 09:13:17 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /home/sandro/Development/Android/Sdk
    • Platform android-30, build-tools 29.0.2
    • ANDROID_HOME = /home/sandro/Development/Android/Sdk
    • Java binary at: /home/sandro/Development/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[✓] Android Studio (version 3.5)
    • Android Studio at /home/sandro/Development/android-studio
    • Flutter plugin version 41.0.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.53.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.20.0

[✓] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 9 (API 28) (emulator)
    • Linux (desktop)                    • linux         • linux-x64      • Linux
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 88.0.4324.182

• No issues found!

2 thoughts on “[linux crash] “Exception: Build process failed” when running apps on stable, that were created on dev

  1. Hi @slovnicki @mivoligo
    I’m able to reproduce the issue.

    previous `dev` channel – `flutter doctor -v`
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$ fdd
      ╔════════════════════════════════════════════════════════════════════════════╗
      ║ A new version of Flutter is available!                                     ║
      ║                                                                            ║
      ║ To update to the latest version, run "flutter upgrade".                    ║
      ╚════════════════════════════════════════════════════════════════════════════╝
    
    
    [✓] Flutter (Channel dev, 1.27.0-8.0.pre, on Linux, locale en_US.UTF-8)
        • Flutter version 1.27.0-8.0.pre at /home/taha/Code/flutter_dev
        • Framework revision b7d4806243 (13 days ago), 2021-02-19 09:22:45 -0800Engine revision 6993cb229b
        • Dart version 2.13.0 (build 2.13.0-30.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /home/taha/Code/SDKPlatform android-30, build-tools 30.0.3ANDROID_HOME = /home/taha/Code/SDKJava binary at: /home/taha/Code/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6222593)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at google-chrome
    
    [✓] Linux toolchain - develop for Linux desktop
        • Ubuntu clang version 11.0.0-2
        • cmake version 3.16.3
        • ninja version 1.10.0
        • pkg-config version 0.29.2
    
    [!] Android Studio (not installed)
        • Android Studio not found; download from
          https://developer.android.com/studio/index.html
          (or visit https://flutter.dev/docs/get-started/install/linux#android-setup
          for detailed instructions).
    
    [✓] VS Code (version 1.53.2)
        • VS Code at /usr/share/code
        • Flutter extension version 3.20.0
    
    [✓] Connected device (2 available)
        • Linux (desktop) • linux  • linux-x64      • LinuxChrome (web)    • chrome • web-javascript • Google Chrome 88.0.4324.150
    
    ! Doctor found issues in 1 category.
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$

    Exisiting dev app on previous dev channel running fine

    logs
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$ flutterd run -d linux
    Launching lib/main.dart on Linux in debug mode...
    Building Linux application...                                           
    Syncing files to device Linux...                                    55ms
    
    Flutter run key commands.
    r Hot reload. 🔥🔥🔥
    R Hot restart.
    h Repeat this help message.
    d Detach (terminate "flutter run" but leave application running).
    c Clear the screen
    q Quit (terminate the application on the device).
    
    Running with unsound null safety
    For more information see https://dart.dev/null-safety/unsound-null-safety
    
    An Observatory debugger and profiler on Linux is available at:
    http://127.0.0.1:45505/bGaR0vth7cQ=/
    The Flutter DevTools debugger and profiler on Linux is available at:
    http://127.0.0.1:9104?uri=http%%3A%%2F%%2F127.0.0.1%%3A45505%%2FbGaR0vth7cQ%%3D%%2F

    New stable

    new `stable` – `flutter doctor -v`
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$ fsd
    [✓] Flutter (Channel stable, 2.0.0, on Linux, locale en_US.UTF-8)
        • Flutter version 2.0.0 at /home/taha/Code/flutter_stable
        • Framework revision 60bd88df91 (20 hours ago), 2021-03-03 09:13:17 -0800
        • Engine revision 40441def69
        • Dart version 2.12.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /home/taha/Code/SDK
        • Platform android-30, build-tools 30.0.3
        • ANDROID_HOME = /home/taha/Code/SDK
        • Java binary at: /home/taha/Code/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6222593)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at google-chrome
    
    [✓] Linux toolchain - develop for Linux desktop
        • Ubuntu clang version 11.0.0-2
        • cmake version 3.16.3
        • ninja version 1.10.0
        • pkg-config version 0.29.2
    
    [!] Android Studio (not installed)
        • Android Studio not found; download from
          https://developer.android.com/studio/index.html
          (or visit https://flutter.dev/docs/get-started/install/linux#android-setup
          for detailed instructions).
    
    [✓] VS Code (version 1.53.2)
        • VS Code at /usr/share/code
        • Flutter extension version 3.20.0
    
    [✓] Connected device (2 available)
        • Linux (desktop) • linux  • linux-x64      • Linux
        • Chrome (web)    • chrome • web-javascript • Google Chrome 88.0.4324.150
    
    ! Doctor found issues in 1 category.
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$

    App fails to run

    taha@pop-os:~/AndroidStudioProjects/dev_flutter$ flutters run -d linux
    Running "flutter pub get" in dev_flutter...                      2,738ms
    Launching lib/main.dart on Linux in debug mode...
    Building Linux application...                                           
    Exception: Build process failed
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$

    flutter create . doesn’t solve the issue

    logs
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$ flutters create .
    Recreating project ....
    Running "flutter pub get" in dev_flutter...                        385ms
    Wrote 3 files.
    
    All done!
    In order to run your application, type:
    
      $ cd .
      $ flutter run
    
    To enable null safety, type:
    
      $ cd .
      $ dart migrate --apply-changes
    
    Your application code is in ./lib/main.dart.
    
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$ flutters run -d linux
    Launching lib/main.dart on Linux in debug mode...
    Building Linux application...                                           
    Exception: Build process failed
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$

    Wokraround

    Delete the linux folder then execute flutter create . and run the app

    logs
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$ flutters create .
    Recreating project ....
      linux/my_application.cc (created)
      linux/CMakeLists.txt (created)
      linux/flutter/CMakeLists.txt (created)
      linux/main.cc (created)
      linux/my_application.h (created)
      linux/.gitignore (created)
    Running "flutter pub get" in dev_flutter...                        393ms
    Wrote 9 files.
    
    All done!
    In order to run your application, type:
    
      $ cd .
      $ flutter run
    
    To enable null safety, type:
    
      $ cd .
      $ dart migrate --apply-changes
    
    Your application code is in ./lib/main.dart.
    
    taha@pop-os:~/AndroidStudioProjects/dev_flutter$ flutters run -d linux
    Launching lib/main.dart on Linux in debug mode...
    Building Linux application...                                           
    Syncing files to device Linux...                                    71ms
    
    Flutter run key commands.
    r Hot reload. 🔥🔥🔥
    R Hot restart.
    h Repeat this help message.
    d Detach (terminate "flutter run" but leave application running).
    c Clear the screen
    q Quit (terminate the application on the device).
    An Observatory debugger and profiler on Linux is available at:
    http://127.0.0.1:43417/2SC81u7oIrg=/
    
    Flutter DevTools, a Flutter debugger and profiler, on Linux is available at:
    http://127.0.0.1:9104?uri=http%%3A%%2F%%2F127.0.0.1%%3A43417%%2F2SC81u7oIrg%%3D%%2F
    
    Running with unsound null safety
    For more information see https://dart.dev/null-safety/unsound-null-safety

    Note

    Surprisingly running the app that was created in the previous dev channel runs fine when you run it on Channel master, 2.1.0-11.0.pre.98 but stills fails on stable channel

    flutter doctor -v
    [✓] Flutter (Channel master, 2.1.0-11.0.pre.98, on Linux, locale en_US.UTF-8)
        • Flutter version 2.1.0-11.0.pre.98 at /home/taha/Code/flutter_master
        • Framework revision 2f7d9d3d26 (5 hours ago), 2021-03-04 03:25:49 -0500
        • Engine revision 91120b358a
        • Dart version 2.13.0 (build 2.13.0-101.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /home/taha/Code/SDK
        • Platform android-30, build-tools 30.0.3
        • ANDROID_HOME = /home/taha/Code/SDK
        • Java binary at: /home/taha/Code/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6222593)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at google-chrome
    
    [✓] Linux toolchain - develop for Linux desktop
        • Ubuntu clang version 11.0.0-2
        • cmake version 3.16.3
        • ninja version 1.10.0
        • pkg-config version 0.29.2
    
    [✓] Android Studio (version 4.1)
        • Android Studio at /home/taha/Code/android-studio
        • Flutter plugin version 53.1.1
        • Dart plugin version 201.9317
        • Java version OpenJDK Runtime Environment (build
          1.8.0_242-release-1644-b3-6222593)
    
    [✓] VS Code (version 1.53.2)
        • VS Code at /usr/share/code
        • Flutter extension version 3.20.0
    
    [✓] Connected device (2 available)
        • Linux (desktop) • linux  • linux-x64      • Linux
        • Chrome (web)    • chrome • web-javascript • Google Chrome 88.0.4324.150
    
    • No issues found!

    Thanks for filing the issue

  2. The workaround worked for me also.

    Just a friendly reminder for developers to have all your custom changes to linux/ stored smartly. If they are by accident buried somewhere in a giant unrelated commit, keep a copy of linux/ before doing the workaround that erases entire linux/ folder.

    For example, I had a change for full-screen (quite common, I would say):

    --- a/linux/my_application.cc
    +++ b/linux/my_application.cc
    @@ -48,7 +48,7 @@ static void my_application_activate(GApplication* application) {
         gtk_window_set_title(window, "app");
       }
     
    -  gtk_window_set_default_size(window, 1280, 720);
    +  gtk_window_fullscreen(window);
       gtk_widget_show(GTK_WIDGET(window));
     
       g_autoptr(FlDartProject) project = fl_dart_project_new();