問題描述
運行“flutter pub get”時在 google_maps_flutter 上解決 Flutter 版本失敗 (Flutter version solving failed on google_maps_flutter while running "flutter pub get")
即使我已將谷歌地圖包降級為 google_maps_flutter: ^0.5.33
這是 ,我在運行
.flutter pub get
時仍收到以下消息><1.0.0
[proj_name] flutter pub get
Running "flutter pub get" in proj_name...
The current Flutter SDK version is 1.22.0‑9.0.pre.
Because proj_name depends on google_maps_flutter >=1.0.0 which requires Flutter SDK version >=1.22.0 <2.0.0, version solving failed.
pub get failed (1; Because proj_name depends on google_maps_flutter >=1.0.0 which requires Flutter SDK version >=1.22.0 <2.0.0, version solving failed.)
exit code 1
pubspec.yaml
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
google_maps_flutter: ^0.5.33
flutter ‑‑version<的結果/代碼>
Flutter 1.22.0‑9.0.pre • channel unknown • unknown source
Framework • revision 7a43175198 (3 months ago) • 2020‑08‑28 23:18:04 ‑0400
Engine • revision 07e2520d5d
Tools • Dart 2.10.0 (build 2.10.0‑73.0.dev)
參考解法
方法 1:
Follow up the steps:
flutter channel stable
flutter upgrade
Then Try again if you get the same error then
just change in your pubspec.yaml file:
from this google_maps_flutter: ^0.5.33
to this google_maps_flutter:
It will automatically work as it will find out the version which is compatible itself.
方法 2:
Try to remove the ^ in pubspec.yaml declaration
google_maps_flutter: ^0.5.33
to google_maps_flutter: '0.5.33'
If I'm not mistaken, the ^ means take this version or higher.
方法 3:
Update flutter version to 2.0.2 stable then clean and run app, this will solve issue
(by Faizan Kamal、Jagadish、Migalv、Bibin Baby)
參考文件