flutterubuntuflutter-upgrade

flutter upgrade doesn't work on the Ubuntu


My old Flutter version is

Flutter 3.7.7 • channel stable •
https://github.com/flutter/flutter.git
Framework • revision 2ad6cd72c0 (4 months ago)
• 2023-03-08 09:41:59 -0800
Engine • revision 1837b5be5f
Tools • Dart 2.19.4 • DevTools 2.20.1

After I tried flutter upgrade or flutter upgrade --force, I got

Upgrading Flutter to 3.10.5 from 3.7.7 in
/root/snap/flutter/common/flutter...
   Woah! You appear to be trying to run Flutter as root.
   We strongly recommend running the flutter tool without superuser privileges.
  /
📎
Downloading Linux x64 Dart SDK from Flutter engine 45f6e009110df4f34ec2cf99f63cf73b71b7a420...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0  203M    0 15145    0     0  65000      0  0:54:49 --:--:--  0:54:49 64722
  0  203M    0 1166k    0     0   944k      0  0:03:41  0:00:01  0:03:40  943k
  9  203M    9 19.6M    0     0  9030k      0  0:00:23  0:00:02  0:00:21 9026k
 19  203M   19 40.6M    0     0  12.5M      0  0:00:16  0:00:03  0:00:13 12.5M
 30  203M   30 61.3M    0     0  14.4M      0  0:00:14  0:00:04  0:00:10 14.4M
 40  203M   40 83.5M    0     0  15.8M      0  0:00:12  0:00:05  0:00:07 16.5M
 50  203M   50  103M    0     0  16.6M      0  0:00:12  0:00:06  0:00:06 20.4M
 61  203M   61  124M    0     0  17.2M      0  0:00:11  0:00:07  0:00:04 20.9M
 71  203M   71  145M    0     0  17.7M      0  0:00:11  0:00:08  0:00:03 21.0M
 81  203M   81  166M    0     0  18.0M      0  0:00:11  0:00:09  0:00:02 21.1M
 92  203M   92  188M    0     0  18.3M      0  0:00:11  0:00:10  0:00:01 20.9M
100  203M  100  203M    0     0  18.5M      0  0:00:10  0:00:10 --:--:-- 21.2M
Building flutter tool...
Resolving dependencies...
Got dependencies.

I stuck with this. I waited for 30 minutes and not thing happened. (The graph on Digitalocean is already stable.) enter image description here

After this, I reconnect my server and type any command of flutter like flutter --version I got

Building flutter tool...
Resolving dependencies... (4.0s)
Got dependencies.
/root/snap/flutter/common/flutter/bin/internal/shared.sh: line 175:  2758 Killed                  "$DART" --verbosity=error --disable-dart-dev $FLUTTER_TOOL_ARGS --snapshot="$SNAPSHOT_PATH" --snapshot-kind="app-jit" --packages="$FLUTTER_TOOLS_DIR/.dart_tool/package_config.json" --no-enable-mirrors "$SCRIPT_PATH" > /dev/null

How to solve this? What wrong?


Solution

  • I upgrade Flutter by reinstalling it.

    1. sudo apt update
    2. sudo snap remove flutter
    3. sudo snap install flutter --classic (wait ~5 min for installing)
    4. flutter --version