1.报错

导入官方flutter demo的时候执行flutter create .报如下错误

Because splash depends on flutter_test any from sdk which depends on test_api 0.2.11, test_api 0.2.11 is required.
So, because splash depends on test_api 0.2.15, version solving failed.
Running "flutter pub get" in splash...
pub get failed (1; So, because splash depends on test_api 0.2.15, version solving failed.)

 

2.解决

2.1 下载dev版本的flutter

从报错来看是什么api的版本对不上,估计是稳定版的flutter和依赖对不齐,下载个最新的dev版本的flutter

https://flutter.dev/docs/development/tools/sdk/releases

 

2.2 配置flutter

将项目的dart sdk设置为新下载好的flutter dev路径

 

2.3 执行命令生成manifest

F:\environment\flutter_demo\flutter-master\examples\splash>D:\fluttter_dev\flutter_windows_1.18.0-8.0.pre-dev\flutter\bin\flutter create .

(由于flutter设置了环境变量,我不想改,就只能完整路径执行命令了)

F:\environment\flutter_demo\flutter-master\examples\splash>D:\fluttter_dev\flutter_windows_1.18.0-8.0.pre-dev\flutter\bin\flutter create .
Recreating project ....
  ios\Runner.xcodeproj\project.xcworkspace\xcshareddata\IDEWorkspaceChecks.plist (created)
  ios\Runner.xcodeproj\project.xcworkspace\xcshareddata\WorkspaceSettings.xcsettings (created)
  ios\Runner.xcworkspace\xcshareddata\IDEWorkspaceChecks.plist (created)
  ios\Runner.xcworkspace\xcshareddata\WorkspaceSettings.xcsettings (created)
Running "flutter pub get" in splash...                              2.7s
Wrote 7 files.

All done!
[√] Flutter: is fully installed. (Channel dev, v1.18.0-8.0.pre, on Microsoft Windows [Version 10.0.18362.778], locale zh-CN)
[√] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 29.0.3)
[√] Android Studio: is fully installed. (version 3.6)
[√] Connected device: is fully installed. (1 available)

In order to run your application, type:

  $ cd .
  $ flutter run

Your application code is in .\lib\main.dart.

之后随便点下get dependencies就好了,可以看到箭头变绿了

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐