当前位置:   article > 正文

Android Studio Flutter报错A dependency may only have one source.

a dependency may only have one source

Android Studio Flutter项目报错A dependency may only have one source. 网上找了问题 及解决方案 记录如下

Error on line 31, column 5 of pubspec.yaml: A dependency may only have one source.31 │ ┌     sdk: flutter
32 │ │     uses-material-design: true
33 │ │ 
34 │ │ 
35 │ │   # The following adds the Cupertino Icons font to your application.
36 │ │   # Use with the CupertinoIcons class for iOS style icons.
37 │ │   cupertino_icons: ^1.0.2
   │ └──^
   ╵
pub get failed (65;)
Process finished with exit code 65
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

原因是
pubspec.yaml 文件添加依赖的内容,特别注意 sdk 对齐格式原因是格式不对,没有对齐
原来格式:

  flutter:
    sdk: flutter
    uses-material-design: true
    cupertino_icons: ^1.0.2
    english_words: ^3.1.0
  • 1
  • 2
  • 3
  • 4
  • 5

需要改为如下:

dependencies:
  flutter:
    sdk: flutter
#  uses-material-design: true
  cupertino_icons: ^1.0.2
  english_words: ^3.1.0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

Android studio的代码格式化还不起左右,只能自己手动改…
改完后还要记Pub get 一下
实在无语

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/307699
推荐阅读
相关标签
  

闽ICP备14008679号