Issue 1:
Reproduction steps:

flutter create test

replace the lib/main.dart with:

import 'package:flutter/widgets.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const Placeholderrr(); // Typo is intentional!
}
}

compile it once with flutter build apk --debug and see an error message.

compile it again with the same command, and see it succeed (as below)

This will really help with fixing syntax errors while coding! We just have to compile twice! 👍

(home/gspencer:master) -- test > flutter build apk --debug
Running "flutter packages get" in test_reload... 0.6s
Initializing gradle... 1.0s
Resolving dependencies... 1.0s
Running 'gradlew assembleDebug'...
compiler message: lib/main.dart:9:18: Error: Method not found: 'Placeholderrr'.
compiler message: return const Placeholderrr();
compiler message: ^
Compiler failed on lib/main.dart

FAILURE: Build failed with an exception.

* Where:
Script '/usr/local/google/home/gspencer/code/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 450

* What went wrong:
Execution failed for task ':app:flutterBuildDebug'.
> Process 'command '/usr/local/google/home/gspencer/code/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

BUILD FAILED in 6s
Gradle build failed: 1
(home/gspencer:master) -- test > flutter build apk --debug
Initializing gradle... 1.0s
Resolving dependencies... 1.0s
Running 'gradlew assembleDebug'... 8.5s
Built build/app/outputs/apk/debug/app-debug.apk.

Issue 2:
Steps to Reproduce

Modify flutter/examples/hello_world/lib/main.dart to add a line: import foo.dart;

Add a flutter/examples/hello_world/lib/foo.dart file. Add some garbage to it that won't compile (e.g. a single line containing asdf).

Invoke flutter run. It reports a compilation error and fails, as expected:

$ flutter run
Using hardware rendering with device Android SDK built for x86. If you get
graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 0.7s
Resolving dependencies... 1.3s
Gradle task 'assembleDebug'...

Compiler message:
lib/foo.dart:1:1: Error: Variables must be declared using the keywords 'const',
'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
asdf
^^^^
lib/foo.dart:1:1: Error: Expected ';' after this.
asdf
^^^^
Compiler failed on
/home/jamesdlin/git/flutter/flutter/examples/hello_world/lib/main.dart
6.3s
Gradle task assembleDebug failed with exit code 1

Without modifying any files, invoke flutter run again.

Result

I expect to see the same failure as in step 3. Instead flutter run syncs files to the emulator, runs the app, and doesn't show the error:

$ flutter run
Using hardware rendering with device Android SDK built for x86. If you get
graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 0.7s
Resolving dependencies... 1.2s
Gradle task 'assembleDebug'... 8.4s
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk... 0.6s
D/ ( 4463): HostConnection::get() New Host Connection established
0xe9e08bc0, tid 4484
D/EGL_emulation( 4463): eglMakeCurrent: 0xebc2dae0: ver 2 0 (tinfo 0xe9e036d0)
Syncing files to device Android SDK built for x86... 1.0s

🔥 To hot reload changes while running, press "r". To hot restart (and rebuild
state), press "R".
An Observatory debugger and profiler on Android SDK built for x86 is available
at: http://127.0.0.1:38847/
For a more detailed help message, press "h". To detach, press "d"; to quit,
press "q".

I see this behavior only with compilation errors in imported files; if I instead introduce compilation errors into main.dart, flutter run consistently fails.

Doctor

[✓] Flutter (Channel master, v0.10.1-pre.43, on Linux, locale en_US.UTF-8)
• Flutter version 0.10.1-pre.43 at /home/jamesdlin/git/flutter/flutter
• Framework revision 4f4005ee65 (2 hours ago), 2018-10-15 12:18:13 -0700
• Engine revision 50c2e69daf
• Dart version 2.1.0-dev.7.0.flutter-b99bcfd309

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /home/jamesdlin/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 27.0.3
• Java binary at: /home/jamesdlin/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1136-b06)
• All Android licenses accepted.

[✓] Android Studio (version 3.2)
• Android Studio at /home/jamesdlin/android-studio
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1136-b06)

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

[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API
28) (emulator)

• No issues found!