10
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Flutter requires SDK version >=2.14.0 <3.0.0, version solving failed.の解決法

Posted at

プラグインを入れるとエラー発生・・・

pubspec.yaml
dependencies:
  flutter:
    sdk: flutter
  http: ^0.13.4

httppackageを入れたところ、以下のようなエラーが発生!!!

The current Dart SDK version is 2.12.2. Because app_name requires SDK version >=2.14.0 <3.0.0, version solving failed. pub get failed (1; Because app_name requires SDK version >=2.14.0 <3.0.0, version solving failed.)

最初は「httppackageが新しくて依存関係に問題があるのかな?」と思い、httpのバージョンを下げてみたりhttppubspec.yamlから消してみたりしましたが、一向に解決されませんでした:sob::sob::sob:

httppackageはあんまり関係ない感じなのか??

とりあえずsdkのバージョンを書き換えてみる

pubspec.yaml
environment:
  sdk: '>=2.14.0<3.0.0'

👆のようにしてみましたが、全く変わらず・・・。。

シンプルにupgradeコマンドで解決

色々と試してみた結果、普通に👇のようなコマンドで私の場合は解決しました。

$ flutter upgrade
Upgrading Flutter to 2.10.0 from 2.0.3 in /Users/gen/developer/flutter...
Downloading Dart SDK from Flutter engine 776efd2034d50af73e2876d703213601df384e88...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  1  209M    1 3774k    0     0  5220k      0  0:00:41 --:--:--  0:00:41 5213k
  9  209M    9 19.1M    0     0  11.0M      0  0:00:18  0:00:01  0:00:17 11.0M
 15  209M   15 33.2M    0     0  12.2M      0  0:00:17  0:00:02  0:00:15 12.2M
 22  209M   22 47.1M    0     0  12.6M      0  0:00:16  0:00:03  0:00:13 12.6M
 30  209M   30 62.9M    0     0  13.3M      0  0:00:15  0:00:04  0:00:11 13.3M
 36  209M   36 75.4M    0     0  13.1M      0  0:00:15  0:00:05  0:00:10 14.3M
 42  209M   42 88.0M    0     0  13.0M      0  0:00:15  0:00:06  0:00:09 13.7M
 48  209M   48  100M    0     0  13.0M      0  0:00:16  0:00:07  0:00:09 13.5M
 53  209M   53  112M    0     0  12.8M      0  0:00:16  0:00:08  0:00:08 13.0M
 57  209M   57  120M    0     0  12.4M      0  0:00:16  0:00:09  0:00:07 11.5M
 63  209M   63  133M    0     0  12.4M      0  0:00:16  0:00:10  0:00:06 11.5M
 69  209M   69  146M    0     0  12.4M      0  0:00:16  0:00:11  0:00:05 11.6M
 75  209M   75  157M    0     0  12.4M      0  0:00:16  0:00:12  0:00:04 11.3M
 81  209M   81  171M    0     0  12.4M      0  0:00:16  0:00:13  0:00:03 11.8M
 86  209M   86  182M    0     0  12.3M      0  0:00:16  0:00:14  0:00:02 12.3M
 90  209M   90  189M    0     0  12.0M      0  0:00:17  0:00:15  0:00:02 11.1M
 96  209M   96  201M    0     0  12.0M      0  0:00:17  0:00:16  0:00:01 11.0M
100  209M  100  209M    0     0  12.1M      0  0:00:17  0:00:17 --:--:-- 11.3M
Building flutter tool...

Upgrading engine...
Downloading Material fonts...                                      440ms
Downloading Gradle Wrapper...                                       21ms
Downloading android-arm-profile/darwin-x64 tools...                224ms
Downloading android-arm-release/darwin-x64 tools...                204ms
Downloading android-arm64-profile/darwin-x64 tools...              249ms
Downloading android-arm64-release/darwin-x64 tools...              176ms
Downloading android-x64-profile/darwin-x64 tools...                250ms
Downloading android-x64-release/darwin-x64 tools...                230ms
Downloading android-x86 tools...                                   950ms
Downloading android-x64 tools...                                   885ms
Downloading android-arm tools...                                 1,242ms
Downloading android-arm-profile tools...                           516ms
Downloading android-arm-release tools...                           293ms
Downloading android-arm64 tools...                                 971ms
Downloading android-arm64-profile tools...                         547ms
Downloading android-arm64-release tools...                         355ms
Downloading android-x64-profile tools...                           592ms
Downloading android-x64-release tools...                           418ms
Downloading android-x86-jit-release tools...                       555ms
Downloading ios tools...                                            4.6s
Downloading ios-profile tools...                                    3.4s
Downloading ios-release tools...                                   17.3s
Downloading Web SDK...                                              5.5s
Downloading CanvasKit...                                         1,557ms
Downloading package sky_engine...                                  147ms
Downloading flutter_patched_sdk tools...                           565ms
Downloading flutter_patched_sdk_product tools...                   497ms
Downloading darwin-x64 tools...                                  2,891ms
Downloading ios-deploy...                                           17ms
Downloading darwin-x64/font-subset tools...                        110ms

Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5f105a6ca7 (3 days ago) • 2022-02-01 14:15:42 -0800
Engine • revision 776efd2034
Tools • Dart 2.16.0 • DevTools 2.9.2

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.0, on macOS 11.1 20C69 darwin-x64, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Xcode - develop for iOS and macOS (Xcode 12.5.1)
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.64.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

注目したいのはここ!!!

$ flutter --version
Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5f105a6ca7 (3 days ago) • 2022-02-01 14:15:42 -0800
Engine • revision 776efd2034
Tools • Dart 2.16.0 • DevTools 2.9.2

Flutter 2.10.0は「Flutter SDKのバージョン」

Dart 2.16.0は「Dart SDKのバージョン」
👇のコマンドでも同様のバージョンが確認できます。

$ dart --version
Dart SDK version: 2.16.0 (stable) (Mon Jan 31 15:28:59 2022 +0100) on "macos_x64"

今回はDart SDKのバージョンが>=2.14.0 <3.0.0で求められていたので、これを解決することができました!

最初**「Flutter SDKの最新stableバージョンは2.10.0なんだが??!!2.14.0とか無いぞ:unamused:」**と思ってましたが、アップすべきはDart SDKのバージョンでした。。

スクリーンショット 2022-02-05 12.01.25.png

ちなみに「stable」は利用が推奨される安定版ブランチのこと。channelについての詳細は👇を参考に

最後に

余談ですがflutter upgrade後、DartはNull safetyな言語になったのでどえらい量のエラーが発生しました・・・:scream:

スクリーンショット 2022-02-04 22.39.51.png

覚悟して取り掛かりましょう!!!!

10
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?