Flutter 未安装在 UBUNTU 20.04 LTS 上

问题描述

我使用的是 Ubuntu 20.04 LTS。我使用 sudo snap install Flutter --classic 安装了 Flutter SDK,然后我使用 sudo snap install andriod-studio --classic 安装了 android studio,但是当我运行时 Flutter doctor 在终端中输出

[✓] Flutter (Channel stable,2.0.3,on Linux,locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    ✗ 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
[!] Android Studio (not installed)
[✓] Connected device (1 available)

! Doctor found issues in 2 categories

N 当我在 VS 代码中打开任何 Flutter 项目并在连接物理设备的终端中点击 Flutter run 进行调试时,它说:

Launching lib/main.dart on dub LX1 in debug mode...
                                                                        
FAILURE: Build Failed with an exception.                                
                                                                        
* What went wrong:                                                      
Could not open settings generic class cache for settings file '/home/suraj/Projects/wordpair/android/settings.gradle' (/home/suraj/.gradle/caches/6.7/scripts/f0emg6u6oecmxqzgk5g9nn4ui).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 60
                                                                        
* 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 7s                                                      
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                         9.2s
Exception: Gradle task assembleDebug Failed with exit code 1

我只想在我的 android 手机上运行 Flutter 项目进行调试。所以有人可以告诉我这里的问题吗?任何帮助将不胜感激!!!

解决方法

在错误出现时阅读错误。它清楚地说明了两件事,以及如何解决这些问题的步骤:

1:运行 flutter doctor --android-licenses

2:安装android studio。

3:在 Linux 上从 here 安装 android studio,而不是使用 snap。

,

其中许多原因是由于从 snap-craft 或 apt s/w 软件包管理器安装软件引起的。尝试使用来自适当网站的原始软件链接下载并解压缩到适当的本地文件夹。

因为那些软件包管理器不会将软件更新到最新版本或最新的错误修复。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...