<p dir="auto">I had a Flutter app that was working just fine until today. I realized that <code class="notranslate">flutter build apk</code> wasn't building the Flutter app with the latest code. Looked up on the internet. Did a <code class="notranslate">flutter clean</code>. Then built the app again with <code class="notranslate">flutter build apk</code>. The following is the error I'm getting,<br>
On Beta channel.</p>
<p dir="auto">===== CRASH =====</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="version=2.1.0-dev.1.0.flutter-ccb16f7282 (Tue Aug 21 22:21:20 2018 +0000) on &quot;linux_simarm&quot;
si_signo=Segmentation fault(11), si_code=1, si_addr=0x4
Dart snapshot generator failed with exit code -6
Snapshotting exited with non-zero exit code: -6
   Woah! You appear to be trying to run flutter as root.
   We strongly recommend running the flutter tool without superuser privileges.
  /
📎
39.5s
Built build/app/outputs/apk/release/app-release.apk (4.3MB)."><pre class="notranslate"><code class="notranslate">version=2.1.0-dev.1.0.flutter-ccb16f7282 (Tue Aug 21 22:21:20 2018 +0000) on "linux_simarm"
si_signo=Segmentation fault(11), si_code=1, si_addr=0x4
Dart snapshot generator failed with exit code -6
Snapshotting exited with non-zero exit code: -6
   Woah! You appear to be trying to run flutter as root.
   We strongly recommend running the flutter tool without superuser privileges.
  /
📎
39.5s
Built build/app/outputs/apk/release/app-release.apk (4.3MB).
</code></pre></div>
<p dir="auto">Before doing "flutter clean" the app size was 6.5 MB.</p>
<p dir="auto">On master channel.<br>
===== CRASH =====</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="version=2.1.0-dev.4.0.flutter-05ccfa8502 (Tue Sep 11 09:03:02 2018 +0000) on &quot;linux_simarm&quot;
si_signo=Segmentation fault(11), si_code=1, si_addr=0x5
Dart snapshot generator failed with exit code -6
Snapshotting exited with non-zero exit code: -6

FAILURE: Build failed with an exception.

* Where:
Script '/opt/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 428

* What went wrong:
Execution failed for task ':app:flutterBuildRelease'.
&gt; Process 'command '/opt/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org"><pre class="notranslate"><code class="notranslate">version=2.1.0-dev.4.0.flutter-05ccfa8502 (Tue Sep 11 09:03:02 2018 +0000) on "linux_simarm"
si_signo=Segmentation fault(11), si_code=1, si_addr=0x5
Dart snapshot generator failed with exit code -6
Snapshotting exited with non-zero exit code: -6

FAILURE: Build failed with an exception.

* Where:
Script '/opt/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 428

* What went wrong:
Execution failed for task ':app:flutterBuildRelease'.
&gt; Process 'command '/opt/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org
</code></pre></div>
<p dir="auto">I then downgraded Flutter. The <code class="notranslate">flutter build apk</code> is working just fine.<br>
How do I resolve this issue?.</p>
<p dir="auto">Flutter Doctor Output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[✓] Flutter (Channel beta, v0.7.3, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] Android Studio (version 3.0)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.25.1)
[!] Connected devices
    ! No devices available

! Doctor found issues in 1 category."><pre class="notranslate"><code class="notranslate">[✓] Flutter (Channel beta, v0.7.3, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] Android Studio (version 3.0)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.25.1)
[!] Connected devices
    ! No devices available

! Doctor found issues in 1 category.
</code></pre></div>
<p dir="auto">Some related content I found regarding this same issue.<br>
<a href="https://github.com/flutter/flutter/issues/14891" data-hovercard-type="issue" data-hovercard-url="/flutter/flutter/issues/14891/hovercard">#14891</a>, <a href="https://github.com/flutter/flutter/issues/21025" data-hovercard-type="issue" data-hovercard-url="/flutter/flutter/issues/21025/hovercard">#21025</a></p>
<p dir="auto">Thank you.</p>
<p dir="auto">Instead it just hangs after printing some obscura about running its isolate:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ (cd ~/flutter/remove_this; flutter clean; flutter run)
Deleting 'build/'.
Launching lib/main.dart on Nexus 5 in debug mode...
Initializing gradle...                                       0.9s
Resolving dependencies...                                    0.8s
Running 'gradlew assembleDebug'...                          13.6s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...                 14.1s
E/flutter (31696): [ERROR:flutter/shell/common/engine.cc(151)] Could not prepare to run the isolate.
E/flutter (31696): [ERROR:flutter/shell/common/engine.cc(116)] Engine not prepare and launch isolate.
E/flutter (31696): [ERROR:flutter/shell/platform/android/android_shell_holder.cc(136)] Could not launch engine in configuration.
Syncing files to device Nexus 5...                           5.3s

🔥  To hot reload changes while running, press &quot;r&quot;. To hot restart (and rebuild state), press &quot;R&quot;.
An Observatory debugger and profiler on Nexus 5 is available at: http://127.0.0.1:40901/
For a more detailed help message, press &quot;h&quot;. To quit, press &quot;q&quot;."><pre class="notranslate"><code class="notranslate">$ (cd ~/flutter/remove_this; flutter clean; flutter run)
Deleting 'build/'.
Launching lib/main.dart on Nexus 5 in debug mode...
Initializing gradle...                                       0.9s
Resolving dependencies...                                    0.8s
Running 'gradlew assembleDebug'...                          13.6s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...                 14.1s
E/flutter (31696): [ERROR:flutter/shell/common/engine.cc(151)] Could not prepare to run the isolate.
E/flutter (31696): [ERROR:flutter/shell/common/engine.cc(116)] Engine not prepare and launch isolate.
E/flutter (31696): [ERROR:flutter/shell/platform/android/android_shell_holder.cc(136)] Could not launch engine in configuration.
Syncing files to device Nexus 5...                           5.3s

🔥  To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
An Observatory debugger and profiler on Nexus 5 is available at: http://127.0.0.1:40901/
For a more detailed help message, press "h". To quit, press "q".
</code></pre></div>
<p dir="auto">Ideally, the app would fail early, with a simple "no main function" error message.</p>