Peter Birdsall
Peter Birdsall

Reputation: 3425

How to clean your build with Flutter RP2 in Android Studio?

With the release of FLutter Release Preview 2 using Android Studio 3.1.4 my project has sporadic build issues when I stop the program from Android Studio with the command stop 'main.dart' (command f2) and then do a run 'main.dart' (^R) I get the error listed below. Yet if I totally close Android Studio and open the project again, it compiles and runs correctly without the error. I'm wondering if there is a way to clean the project to elevate having to close and open Android Studio, this is sort of counter productive to Flutter hot reload.

Here's the Android Studio error that I get:

Launching lib/main.dart on Android SDK built for x86 in debug mode... [{"event":"app.progress","params":{"appId":"04e99281-55ea-41cd-851f-5b07487c5302","id":"0","progressId":null,"message":"Initializing gradle..."}}]Initializing gradle...

Resolving dependencies... Running 'gradlew assembleDebug'... registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) compiler message: lib/ui/loginScreen.dart:1:1: Error: Can't access platform private library. compiler message: import 'dart:_http'; compiler message: ^ Compiler failed on /Users/pbirdsall/Documents/highline/hl_leverage/lib/main.dart

FAILURE: Build failed with an exception.

BUILD FAILED in 8s Finished with error: Gradle build failed: 1

You can ignore the following part of the error log (in italics above), as this occurs on a successful execution of the program.

deprecated, use registerGeneratedFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) compiler message: lib/ui/loginScreen.dart:1:1: Error: Can't access platform private library. compiler message: import 'dart:_http'; compiler message: ^ Compiler failed on

My version of Android Studio is 3.1.4

My version of Flutter is:

Flutter 0.8.2 • channel beta • https://github.com/flutter/flutter.git Framework • revision 5ab9e70727 (2 weeks ago) • 2018-09-07 12:33:05 -0700 Engine • revision 58a1894a1c Tools • Dart 2.1.0-dev.3.1.flutter-760a9690c2

I'm running on macOS High Sierra 10.13.6

Upvotes: 13

Views: 22988

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657781

Menu Tool > Flutter > Flutter Clean

or in a terminal window in the project directory

flutter clean

Upvotes: 41

Related Questions