mvww11
mvww11

Reputation: 33

Can't run 'Pub get' and can't build flutter project

On Android Studio, I clone this flutter project. When prompted if I want to create a project for the sources downloaded, I click no. Then I click "open existing project", and select the project just downloaded.

Android Studio tells me that "Pub get has not been run". So I click "Get dependencies":

C:\src\flutter\flutter\bin\flutter.bat --no-color pub get
Running "flutter pub get" in dicee-flutter2...                      3,0s
Process finished with exit code 0

After this, the highlighting in the code is corrected, so I guess the project recognizes flutter now. But the "Pub get has not been run" prompt never disappears.

Then I run my project, in order to see it in the virtual device, but I get the following error:

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
--output directory is required for assemble.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 896

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\flutter\bin\flutter.bat'' 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 2s
Exception: Gradle task assembleDebug failed with exit code 1

The output of flutter doctor is:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 1.20.0-3.0.pre.78, on Microsoft Windows [versão 10.0.18362.356], locale pt-BR)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[√] Android Studio (version 4.0)
[√] Connected device (1 available)

• No issues found!

How to fix that, so I can see the project on the virtual device and stop getting the "Pub get has not been run" prompt?

Upvotes: 1

Views: 1751

Answers (1)

Brett Sutton
Brett Sutton

Reputation: 4554

There is a setting in AS to set the output directory. From memory it's in the file | project settings menu.

This is possibly a separate issue to the pub get problem.

You can just run flutter pub get from the cli in the projects root directory.

Upvotes: 1

Related Questions