elyar abad
elyar abad

Reputation: 788

FLUTTER FIRST RUN: Build failed with an exception

I'm trying to perform my first run of a test app on flutter via Genymotion, but I get nothing except this message in console:

Launching lib\main.dart on Motorola Moto X in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:3.5.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
       - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
       - https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
       - https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
     Required by:
         project :

* 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 26s
Finished with error: Gradle task assembleDebug failed with exit code 1

Also (it may be helpful, I think), under the build menu, I don't find some practical sub-menus; such as build, clean, or ...

What could be the problem?

any help is really appreciated!


Since @TaufikNurRahmanda needed the response of flutter doctor and flutter clean commands as more details, I am adding them as an edit;

flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.7, on Microsoft Windows [Version 10.0.10586], locale en-US)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    X Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
      instructions.
[√] Android Studio (version 3.4)
[√] IntelliJ IDEA Community Edition (version 2019.3)
[√] Connected device (1 available)

! Doctor found issues in 1 category.

flutter clean:

Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Do not run this command from the root of your git clone of Flutter.

Also the response of flutter doctor --android-licenses may be useful (although I have Android SDK Build-tools 29.0.3 installed):

A newer version of the Android SDK is required. To update, run: C:\Users\[user]\AppData\Local\Android\android-sdk\tools\bin\sdkmanager --update

And when I run the suggested command above (sdkmanager --update), I get this:

Error: Could not find or load main class '-Dcom.android.sdklib.toolsdir=C:\Users\[user]\AppData\Local\Android\android-sdk\tools\bin\\..-XX:+IgnoreUnrecognizedVMOptions 

Upvotes: 0

Views: 278

Answers (1)

user12816337
user12816337

Reputation: 61

Seems you do not accepted some android licenses. Just run:

flutter doctor --android-licenses

And accept y all licences.

Upvotes: 1

Related Questions