Flutter 为什么我不能将一些包添加到pubspec.yaml文件?
当我尝试在pubspec.yaml中将flatter_sound:^7.7.0+1添加到依赖项并按“pub get”时,我收到下面的错误消息,如何解决此问题 公开发行Flutter 为什么我不能将一些包添加到pubspec.yaml文件?,flutter,yaml,Flutter,Yaml,当我尝试在pubspec.yaml中将flatter_sound:^7.7.0+1添加到依赖项并按“pub get”时,我收到下面的错误消息,如何解决此问题 公开发行 名称:lezzet_kitabi 描述:一个新的颤振应用。 #以下行可防止将包意外发布到 #pub.dev使用“pub publish”。这是私人软件包的首选。 发布到:“无”#如果要发布到pub.dev,请删除此行 #下面定义了应用程序的版本和内部版本号。 #版本号是由点分隔的三个数字,如1.2.43 #后跟可选的内部版本号,以
名称:lezzet_kitabi
描述:一个新的颤振应用。
#以下行可防止将包意外发布到
#pub.dev使用“pub publish”。这是私人软件包的首选。
发布到:“无”#如果要发布到pub.dev,请删除此行
#下面定义了应用程序的版本和内部版本号。
#版本号是由点分隔的三个数字,如1.2.43
#后跟可选的内部版本号,以+分隔。
#版本和制造商编号都可能在颤振中被覆盖
#通过分别指定--build name和--build number来生成。
#在Android中,版本名用作版本名,而版本号用作版本代码。
#更多关于Android版本控制的信息,请访问https://developer.android.com/studio/publish/versioning
#在iOS中,生成名称用作CbundleShortVersionString,而生成编号用作CbundLeverVersion。
#阅读有关iOS版本控制的更多信息,请访问
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
版本:1.0.0+1
环境:
sdk:“>=2.7.0此问题是由于您的项目依赖于其他包
根据文档,它们的版本控制中存在冲突,可以解决冲突
您可以阅读相关内容(官方颤振文档).这只是意味着您正在添加的某些依赖项需要比其他软件包更高或更低版本的某些依赖项,从而导致这些依赖项之间发生冲突。解决此问题的最佳方法是覆盖使用最佳版本的依赖项,即存在冲突的依赖项或找到替代依赖项或者,将pubspec复制到一个安全的地方,然后去掉所有的依赖项(对于“任何版本”),看看它是否能想出一个解决方案。如果不能,你很可能无法进行小的调整。如果它真的起作用,并且测试通过(你确实有测试,对吗?),您可以从pubspec.lock file.Hmm复制解决方案版本。尝试了一下,得到了以下结果:因为每个版本的带边框的_文本都依赖于sdk中禁止的flutter any,所以带边框的_文本是禁止的。所以,因为foo依赖于带边框的_文本any,版本求解失败。编辑:哦,奇怪,我刚刚又做了一次pub dart get,它成功了!怎么办你是说testin先生?
name: lezzet_kitabi
description: A new Flutter application.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
bordered_text: ^1.0.1
sqflite: ^1.3.0
path_provider: ^1.6.27
provider: ^4.3.3
integration_test: ^1.0.2+2
camera: 0.5.8+17
image_picker: ^0.6.7+22
path: ^1.8.0
flutter_sound: ^7.7.0+1
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- images/logoBGopacity.png
- images/logoBG.png
- images/cuttedlogo.PNG
- images/sticker0.png
- images/sticker1.png
- images/sticker2.png
- images/sticker3.png
- images/sticker4.png
- images/sticker5.png
- images/sticker6.png
- images/sticker7.png
- images/sticker8.png
- images/sticker9.png
- images/sticker10.png
- images/sticker11.png
- images/sticker12.png
- images/sticker13.png
- images/sticker14.png
- images/sticker15.png
- images/sticker16.png
- images/sticker17.png
- images/sticker18.png
- images/sticker19.png
- images/sticker20.png
- images/sticker21.png
- images/sticker22.png
- images/stickerForRecipeScreen.png
fonts:
- family: Marck
fonts:
- asset: fonts/MarckScript-Regular.ttf
- family: Graduate
fonts:
- asset: fonts/Graduate-Regular.ttf
- family: OpenSans
fonts:
- asset: fonts/OpenSansCondensed-Light.ttf
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages