【问题标题】:Flutter not installed on UBUNTU 20.04 LTSFlutter 未安装在 UBUNTU 20.04 LTS 上
【发布时间】:2021-06-22 22:53:20
【问题描述】:

我在 Ubuntu 20.04 LTS 上。我使用 sudo snap install flutter --classic 安装了颤振 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

当我在 VS 代码中打开任何颤振项目并在连接物理设备的终端中点击 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 studio并尝试运行它,还有flutter doctor --android-licenses,还要确保你已经安装了android studio@Suraj Oberai
  • 我确实使用 snap 安装了 android studio,但运行时仍然提示未安装 flutter doctor
  • 你能打开android studio吗?@Suraj Oberai

标签: flutter android-studio-3.0 ubuntu-20.04


【解决方案1】:

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

1:运行flutter doctor --android-licenses

2:安装安卓工作室。

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

【讨论】:

  • 我运行 flutter doctor --android-licenses 得到了这个:Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
  • @SurajOberai 我编辑了我的答案。从该链接安装 android studio,而不是从 snap,然后配置 flutter dr 以找到您的 android studio 路径。
  • 很久以前我也通过解压 zip 文件安装了 android studio,现在我有两个 android studio 图标,一个是通过提取 zip 安装 android studio,另一个是 snap。我成功删除了快照之一,但在运行 flutter doctor 时我仍然没有安装 android studio
  • 要纠正这个问题,你需要告诉flutter doctor android studio 的安装位置。并将其指向您的 zip 安装目录,请尝试并更新发生的情况。
  • 你能告诉我如何从解压缩 zip 中删除安装的 android studio,好吗?我会尝试卸载然后重新安装。我尝试删除所有目录,如 android、android studios 以及与 android studio 相关的每个目录,但没有运气。图标还在。
【解决方案2】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-18
    • 2020-09-29
    • 2020-08-07
    • 1970-01-01
    • 1970-01-01
    • 2021-01-16
    • 2020-09-01
    • 2020-10-04
    相关资源
    最近更新 更多