3

I'm using the standard flutter app on Android Studio and when I can't execute flutter pub get and when I execute flutter run I get this exception

FAILURE: Build failed with an exception.

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

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

I already try force upgrade and flutter clean

Flutter Doctor -v

[√] Flutter (Channel stable, v1.17.0, on Windows, locale pt-BR)
    • Flutter version 1.17.0 at C:\src\flutter
    • Framework revision e6b34c2b5c (4 days ago), 2020-05-02 11:39:18 -0700
    • Engine revision 540786dd51
    • Dart version 2.8.1


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\kaduc\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[!] IntelliJ IDEA Community Edition (version 2019.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.3
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[√] VS Code (version 1.44.2)
    • VS Code at C:\Users\kaduc\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.10.1

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

! Doctor found issues in 1 category.

I already uninstall Android Studio IDE and reinstall and I try reinstalling Java JDK but don't chance anything don't know what can I do to fix this issue.

2
  • 1
    Did you try flutter clean? Commented May 7, 2020 at 4:35
  • try flutter clean and then flutter run /debug your project.make sure you're connected to the internet Commented May 7, 2020 at 5:17

3 Answers 3

4

Problem:
Either flutter and dart plugins are not download properly or not configured properly with Android Studio.
Solution:
There is a way to fix this. You can just install/reinstall the Flutter & Dart plugin in android studio by steps below.
1) Open the Android Studio.
2) Open plugin preferences (File > Settings > Plugins on "Windows" & "Linux" or Preferences > Plugins on "macOS").
3) Select Browse repositories, select the Flutter plug-in and click install.
4) Click Yes when prompted to install the Dart plugin.
5) Click Restart when prompted.
6) Run command: sudo chown -R YOUR_USERNAME YOUR_FLUTTER_DIRECTORY
Example: sudo chown -R sanketvekariya /opt/flutter
Some References:
https://github.com/flutter/flutter/issues/21881
https://github.com/flutter/flutter/issues/45528
Flutter plugin not installed error;. When running flutter doctor
FYI:
I have faced same issue earlier and solved by above steps. Hope you solve this soon.:)

Sign up to request clarification or add additional context in comments.

2 Comments

Ty man Actually my Android Studio was on offline mode and I couldn't get the plugin but your answer show me where to look for problems.
your welcome! You can also upvote the answer along with accepting. Thanks!
0

I delete the \android\app\build folder, the issue was resolved.

Comments

0

In my case, the problem was that I cloned the project from repo and project was developed by my colleague months ago. So I solved the issue by updating gradle version in gradle-wrapper.properties file and also updating tools.build:gradle in android/build.gradle file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.