【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 Repository和Android Support Repository, 我把Support Repository全部勾选了。

image.png

结果

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

license

VSCode中启动运行按 F5 键或调用Debug>Start Debugging,应该算成功了吧,没有报错提示。
结果图.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)

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • @[TOC](求解flutter环境配置的一个问题) # 问题已解决,问题置底,解决方案置顶(本文章只解决 ! S...
    jiangji阅读 14,361评论 2赞 3
  • 1. 简介 Flutter是谷歌的移动UI框架,可以快速在iOS和Android上构建高质量的原生用户界面。 Fl...
    yangsg阅读 2,473评论 3赞 8
  • 前言:作为一只刚刚躺完坑的猿、以简书的方式记录这配置的大型入坑现场。 flutter 特点:跨平台,高质量,热更新...
    Aimee的抱抱阅读 2,092评论 0赞 2
  • 昨天,是儿童节,我们一共举行了四项活动,分别是做风筝,歌舞秀,复古游戏和放风筝。令我影响最深的是歌舞秀和复古...
    俊豪_0a50阅读 226评论 0赞 0
  • 一直以来自己都希望过上纯粹的生活:一切事情安排的有条不紊,每天通过自己的技术赚钱,学习感兴趣的专业,偶尔去外面的世...
    Drluffyzpf阅读 429评论 0赞 2

友情链接更多精彩内容