FLUTTER FIRST RUN:生成失败,发生异常

时间:2020-02-12 14:23:20

标签: flutter

我正在尝试通过 run 扑朔迷离地执行 test app 的第一个Genymotion,但除此消息外,我什么也没得到在控制台中:

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

(在我看来,这可能会有所帮助)在build menu下,我找不到一些实用的子菜单;例如buildclean或...

可能是什么问题?

非常感谢的任何帮助!


由于@TaufikNurRahmanda需要 flutter doctor flutter clean 命令的响应作为更多详细信息,因此我将其添加为编辑内容;

颤抖的医生:

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.

干净整洁:

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.

flutter doctor --android-licenses的响应也可能有用(尽管我已经安装了Android SDK Build-tools 29.0.3):

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

当我在上方(sdkmanager --update)上运行建议的命令时,我得到了:

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

1 个答案:

答案 0 :(得分:1)

似乎您不接受某些Android许可证。只需运行:

flutter doctor --android-licenses

并接受y所有许可。