【问题标题】:VSCODE: Flutter failing to build for AndroidVSCODE:Flutter 无法为 Android 构建
【发布时间】:2021-08-03 11:06:29
【问题描述】:
    flutter  run      
Launching lib/main.dart on AC2001 in debug mode...
Checking the license for package SDK Patch Applier v4 in /home/diva/Android/Sdk/licenses
Warning: License for package SDK Patch Applier v4 not accepted.         
Checking the license for package Android Emulator in /home/diva/Android/Sdk/licenses
Warning: License for package Android Emulator not accepted.             
Checking the license for package Android SDK Tools in /home/diva/Android/Sdk/licenses
Warning: License for package Android SDK Tools not accepted.            
Checking the license for package Android SDK Build-Tools 29.0.2 in /home/diva/Android/Sdk/licenses
Warning: License for package Android SDK Build-Tools 29.0.2 not accepted.
Checking the license for package Android SDK Platform 30 in /home/diva/Android/Sdk/licenses
Warning: License for package Android SDK Platform 30 not accepted.      
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     patcher;v4 SDK Patch Applier v4                                    
     platforms;android-30 Android SDK Platform 30                       
     emulator Android Emulator                                          
     tools Android SDK Tools                                            
     build-tools;29.0.2 Android SDK Build-Tools 29.0.2                  
  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: /home/diva/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 1s                                                      
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                      2,203ms
Exception: Gradle task assembleDebug failed with exit code 1

我正在尝试使用 VSCODE 运行 Flutter,但尚未下载 Android Studio。我刚刚开始学习 Flutter,非常新。

Android SDK 构建工具 == 29.0.3 和颤振 == 2.2.3

新:运行颤振医生后,它说我应该运行 android-licenses

Android toolchain - develop for Android devices
    (Android SDK version 29.0.3)
    • Android SDK at /home/diva/Android/Sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at:
      /usr/lib/jvm/java-11-oracle/bin/java
    • Java version Java(TM) SE Runtime Environment
      18.9 (build 11.0.11+9-LTS-194)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to
      accept the SDK licenses.
      See
      https://flutter.dev/docs/get-started/install/
      linux#android-setup for more details.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

颤振医生--android-licenses

Android sdkmanager tool not found
(/home/diva/Android/Sdk/tools/bin/sdkmanager).
Try re-installing or updating your Android SDK,
visit
https://flutter.dev/docs/get-started/install/linux#
android-setup for detailed instructions.

【问题讨论】:

  • 运行flutter doctor 然后发布输出

标签: flutter


【解决方案1】:

运行这个 'flutter doctor --android-licenses' 然后输入 y 接受每个 许可证。 CMD 将一一显示您拥有的每个许可证 通过在 CMD 提示符下输入 y 来接受。它解决了我的问题。我希望 这也对你有用

【讨论】:

    【解决方案2】:

    正如错误输出所暗示的那样。您需要接受许可协议

    Android SDK 包因为某些许可证尚未被接受。

    解决这个问题

    1. 去你的终端

    2. 颤振医生--android-licenses

    3. 按 (y) 到

      接受

    【讨论】:

      猜你喜欢
      • 2021-12-26
      • 2017-01-10
      • 2019-03-08
      • 1970-01-01
      • 1970-01-01
      • 2014-08-05
      • 1970-01-01
      • 1970-01-01
      • 2023-03-12
      相关资源
      最近更新 更多