Reputation: 4274
Here what I'm trying to do is build my flutter application using VS Code. When I'm run the following command flutter build apk
FAILURE: Build failed with an exception.
* Where:
Build file 'F:\year-03\SEM2\events\GSOC\LabelLab\labellab_mobile\android\build.gradle' line: 27
* 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\Mr.Semicolon\AppData\Local\Android\sdk
To understand the exact solution I'll describe all the steps that I followed to setup Flutter in VS Code IDE.
1. Download Flutter Windows SDK from https://flutter.dev
2. Extract the file to the C drive
3. Go to the file path C:\flutter\bin
and set the environment variable.
4. In VS Code IDE install the Flutter and Dart extensions.
5. Run the application using flutter build apk
Edit:
flutter doctor
output,
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18362.720], locale en-GB)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
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.6)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.3)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.44.0)
[!] Connected device
! No devices available
Upvotes: 0
Views: 2822
Reputation: 21
In some machines, you need to open the command prompt as an administrator. So, you can try out the following steps and check
flutter doctor --android-licenses
and accept all.
licenses by pressing Y.flutter doctor -v
to check whether the issue is still there; flutter doctor -v
to make sure everything is okay.If it still giving you the same issue visit your flutter folder and open the file called flutter_console.bat and type this command flutter doctor --android-licenses
.
Upvotes: 1
Reputation: 2956
This error is due to lack of license agreement.
Open your terminal.
flutter doctor --android-licenses
Press y
to accept every license.
Upvotes: 1