VS代码:由于某些许可证未被接受,因此无法安装以下Android SDK软件包 [英] VS Code: Failed to install the following Android SDK packages as some licences have not been accepted

查看:89
本文介绍了VS代码:由于某些许可证未被接受,因此无法安装以下Android SDK软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我要使用VS Code构建Flutter应用程序的方法.当我运行以下命令时, flutter build apk

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

要了解确切的解决方案,我将描述在VS Code IDE中设置Flutter所遵循的所有步骤.
1.从 https://flutter.dev
下载Flutter Windows SDK.2.将文件解压缩到C驱动器
3.转到文件路径 C:\ flutter \ bin 并设置环境变量.
4.在VS Code IDE中,安装Flutter和Dart扩展.5.使用 flutter build apk

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\binand set the environment variable.
4. In VS Code IDE install the Flutter and Dart extensions.
5. Run the application using flutter build apk

flutter doctor 输出,

[√] 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

推荐答案

在某些计算机中,您需要以管理员身份打开命令提示符.因此,您可以尝试以下步骤并检查

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 并接受所有命令.通过按 Y 来获得许可.
  • 运行命令 flutter doctor -v 来检查问题是否仍然存在;
  • 以常规用户身份登录,然后尝试 flutter doctor -v 以确保一切正常.
  • Execute command prompt as administrator.
  • Run the command flutter doctor --android-licenses and accept all. licenses by pressing Y.
  • Run the command flutter doctor -v to check whether the issue is still there;
  • Login as a regular user and try flutter doctor -v to make sure everything is okay.

如果仍然给您同样的问题,请访问flutter文件夹并打开名为 flutter_console.bat 的文件,然后键入以下命令 flutter doctor --android-licenses .

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.

这篇关于VS代码:由于某些许可证未被接受,因此无法安装以下Android SDK软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆