安裝搭建Flutter運行環(huán)境按照Flutter中文網(wǎng)步驟一步一步來蠢甲。
報錯提示主要提取
搭建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
全部勾選了纠屋。
結果
原先只有一個android-sdk-preview-license
文件,如今多了android-sdk-license
文件
VSCode中啟動運行按
F5
鍵或調用Debug>Start Debugging
惨险,應該算成功了吧羹幸,沒有報錯提示。運行報錯提示
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)