首页 > 解决方案 > Flutter 未安装在 UBUNTU 20.04 LTS 上

问题描述

我在 Ubuntu 20.04 LTS 上。我安装了颤振 SDK sudo snap install flutter --classic,然后我安装了 android studio,sudo snap install andriod-studio --classic但是当我 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 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 手机上运行颤振项目进行调试。所以有人可以告诉我这里的问题吗?任何帮助,将不胜感激!!!

标签: flutterandroid-studio-3.0ubuntu-20.04

解决方案


Read the errors when they appear. It's clearly saying two things, with steps how to solve them:

1: run flutter doctor --android-licenses.

2: install android studio.

3: Install android studio from here on linux, not by using snap.


推荐阅读