技术频道


Flutter 升级失败解决

先用 flutter doctor 检测:


$ flutter doctor


  ╔════════════════════════════════════════════════════════════════════════════╗
  ║ A new version of Flutter is available!                                     ║
  ║                                                                            ║
  ║ To update to the latest version, run "flutter upgrade".                    ║
  ╚════════════════════════════════════════════════════════════════════════════╝


Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.17763.1282], locale zh-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.5)
[√] VS Code (version 1.53.2)
[!] Proxy Configuration
    ! NO_PROXY is not set
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

然后 flutter upgrade 升级:


flutter upgrade

运行 flutter upgrade,结果提示升级失败:Unable to upgrade Flutter: no origin repository configured. Run 'git remote add origin https://github.com/flutter/flutter' in D:\Flutter_SDK ..

运行 flutter 以下命令可以解决问题:


flutter channel stable


Switching to flutter channel 'stable'...
Upgrading Flutter from D:\Flutter_SDK...
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine 2f0af3715217a0c2ada72c717d4ed9178d68f6ed...
Unzipping Dart SDK...
Building flutter tool...
Running pub upgrade...

Upgrading engine...
Flutter assets will be downloaded from https://storage.flutter-io.cn/. Make sure you trust this source!
Downloading Material fonts...                                       1.8s
Downloading Android Maven dependencies...                         213.4s (!)
Downloading android-arm-profile/windows-x64 tools...                1.5s
Downloading android-arm-release/windows-x64 tools...                1.3s
Downloading android-arm64-profile/windows-x64 tools...              1.6s
Downloading android-arm64-release/windows-x64 tools...              1.4s
Downloading android-x64-profile/windows-x64 tools...                1.6s
Downloading android-x64-release/windows-x64 tools...                1.4s
Downloading android-x86 tools...                                   17.9s
Downloading android-x64 tools...                                   18.1s
Downloading android-arm tools...                                    8.2s
Downloading android-arm-profile tools...                            4.2s
Downloading android-arm-release tools...                            3.2s
Downloading android-arm64 tools...                                  8.8s
Downloading android-arm64-profile tools...                          4.9s
Downloading android-arm64-release tools...                          3.8s
Downloading android-x64-profile tools...                            4.8s
Downloading android-x64-release tools...                            3.8s
Downloading android-x86-jit-release tools...                        6.0s
Downloading package sky_engine...                                   1.1s
Downloading flutter_patched_sdk tools...                            8.9s
Downloading flutter_patched_sdk_product tools...                    8.9s
Downloading windows-x64 tools...                                   21.9s
Downloading windows-x64/font-subset tools...                        2.3s

Flutter 1.22.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 9b2d32b605 (5 weeks ago) • 2021-01-22 14:36:39 -0800
Engine • revision 2f0af37152
Tools • Dart 2.10.5

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.17763.1282], locale zh-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.5)
[√] VS Code (version 1.53.2)
[!] Proxy Configuration
    ! NO_PROXY is not set
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

  ╔════════════════════════════════════════════════════════════════════════════╗
  ║                 Welcome to Flutter! - https://flutter.dev                  ║
  ║                                                                            ║
  ║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
  ║ statistics and basic crash reports. This data is used to help improve      ║
  ║ Flutter tools over time.                                                   ║
  ║                                                                            ║
  ║ Flutter tool analytics are not sent on the very first run. To disable      ║
  ║ reporting, type 'flutter config --no-analytics'. To display the current    ║
  ║ setting, type 'flutter config'. If you opt out of analytics, an opt-out    ║
  ║ event will be sent, and then no further information will be sent by the    ║
  ║ Flutter tool.                                                              ║
  ║                                                                            ║
  ║ By downloading the Flutter SDK, you agree to the Google Terms of Service.  ║
  ║ Note: The Google Privacy Policy describes how data is handled in this      ║
  ║ service.                                                                   ║
  ║                                                                            ║
  ║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and  ║
  ║ crash reports to Google.                                                   ║
  ║                                                                            ║
  ║ Read about data we send with crash reports:                                ║
  ║ https://flutter.dev/docs/reference/crash-reporting                         ║
  ║                                                                            ║
  ║ See Google's privacy policy:                                               ║
  ║ https://policies.google.com/privacy                                        ║
  ╚════════════════════════════════════════════════════════════════════════════╝

flutter upgrade 扩展阅读:



发表评论