【flutter 运行报错】Error running Gradle and Android SDK licences

安装搭建Flutter运行环境按照Flutter中文网步骤一步一步来。

报错提示主要提取

搭建flutter运行时报错:想直接看冗长的报错Info请拉到文末

  • A. Error running Gradle
  • B. Failed to install the following Android SDK packages as some licences have not been accepted.

解决方案

需要在SDK Manager里下载Google RepositoryAndroid Support Repository, 我把Support Repository全部勾选了。

【flutter 运行报错】Error running Gradle and Android SDK licences_第1张图片
image.png

结果

原先只有一个android-sdk-preview-license文件,如今多了android-sdk-license文件

【flutter 运行报错】Error running Gradle and Android SDK licences_第2张图片
license

VSCode中启动运行按 F5 键或调用Debug>Start Debugging,应该算成功了吧,没有报错提示。
【flutter 运行报错】Error running Gradle and Android SDK licences_第3张图片
结果图.gif

运行报错提示

Launching lib\main.dart on Android SDK built for x86 in debug mode...
* Error running Gradle:
ProcessException: Process "F:\flutter\hello_world\android\gradlew.bat" exited abnormally:
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :app
File C:\Users\用户名\.android\repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\用户名\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in C:\Users\用户名\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Platform 28 not accepted.


FAILURE: Build failed with an exception.

* Where:
Build file 'F:\flutter\hello_world\android\build.gradle' line: 30

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Failed to install the following Android SDK packages as some licences have not been accepted.
        build-tools;28.0.3 Android SDK Build-Tools 28.0.3
        platforms;android-28 Android SDK Platform 28
     To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
     Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

     Using Android SDK: C:\Users\用户名\AppData\Local\Android\sdk

* 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 57s
  Command: F:\flutter\hello_world\android\gradlew.bat app:properties

Please review your Gradle project setup in the android/ folder.
Exited (sigterm)

你可能感兴趣的:(【flutter 运行报错】Error running Gradle and Android SDK licences)