Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

  • Where: Script '/Users/pbirdsall/flutter/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 460

  • What went wrong: Execution failed for task ':app:flutterBuildDebug'.

    Process 'command '/Users/pbirdsall/flutter/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.

  • Get more help at https://help.gradle.org

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

like image 592
Peter Birdsall Avatar asked Sep 24 '18 19:09

Peter Birdsall


People also ask

How do I clean my project Flutter?

Go to Tools > Flutter > Flutter Clean to clear the build cache of the Flutter project.

How do I clean my Flutter gradle?

Go down to Flutter and click on the 'Open Android module in Android Studio'. Now, click on 'gradle' in the right panel. Next, click on 'Execute Gradle Task' icon. Now, Run the command gradlew clean.


1 Answers

Menu Tool > Flutter > Flutter Clean

or in a terminal window in the project directory

flutter clean
like image 159
Günter Zöchbauer Avatar answered Oct 09 '22 02:10

Günter Zöchbauer