当前位置: 首页 > 知识库问答 >
问题:

颤振版本解决失败

劳亦
2023-03-14

我试图在我刚刚创建的flutter项目中执行pub get命令,但它开始出现这个错误:

D:\flutter\bin\flutter.bat --no-color pub get
Running "flutter pub get" in stock_exchange...                  
Because every version of flutter from sdk depends on meta 1.1.8 which doesn't match any versions, flutter from sdk is forbidden.

So, because stockexchange depends on flutter any from sdk, version solving failed.
pub get failed (1; So, because stockexchange depends on flutter any from sdk, version solving failed.)
Process finished with exit code 1

pubspec.yaml

name: stockexchange
description: A new Flutter application.

# 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.1.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: ^0.1.2

dev_dependencies:


# 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/a_dot_burr.jpeg
  #  - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages
D:\AndroidDevelopment\stock_exchange>flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.17763.1039], locale en-IN)
    • Flutter version 1.12.13+hotfix.9 at D:\flutter
    • Framework revision f139b11009 (4 weeks ago), 2020-03-30 13:57:30 -0700
    • Engine revision af51afceb8
    • Dart version 2.7.2


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at D:\Android\SDK
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = D:\Android\SDK
    • Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at D:\Program Files\Android\Android Studio
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.
Because every version of flutter from sdk depends on meta 1.1.8 which doesn't match any versions, flutter from sdk is forbidden.
So, because stockexchange depends on flutter any from sdk, version solving failed.
Running "flutter pub get" in stock_exchange...
pub get failed (1; So, because stockexchange depends on flutter any from sdk, version solving failed.)

共有1个答案

戚宏浚
2023-03-14

我找到了问题的解决方案,我只需要将环境变量pub_hosted_url的值更改为https://pub.dev。然而,对于变量的正确值,这可能取决于您的位置,如果您不知道,那么最好的办法就是删除变量,让flutter自动决定URL。

 类似资料:
  • 在调试模式下启动M2101K7AG上的lib\main.dart...正在运行Gradle任务'assembleDebug'... 失败:构建失败,有一个异常。 哪里出错了:配置根项目'android'时出现问题。 无法解析配置: classpath的所有工件。无法下载bundletool-0.14.0.jar(com.android.tools.build: bundletool: 0.14.0

  • Windows PowerShell版权所有(C)微软公司。版权所有。尝试新的跨平台PowerShellhttps://aka.ms/pscore6PS C:\用户\联想\桌面\Android

  • 当我运行命令时,由于flutter设置的Dart版本,我得到了以下错误: Flutter 0.6.0•频道beta•https://github.com/Flutter/Flutter.git 框架•修订9299C02CF7(2周前)•2018-08-16 00:35:12+0200 引擎•修订E3687F70C7 工具•飞镖2.1.0-dev.0.0.Flutter-BE6309690F 我想知

  • 注意:使用-Xlint重新编译:详细信息请参阅弃用。D8:程序类型已存在:android。支持v4.os。ResultReceiver$MyResultReceiver 失败:构建失败,但有例外。 > 错误:任务执行失败:应用程序:transformDexArchiveWithExternalLibsDexMergerForDebug”。 通用域名格式。Android建设者德兴。DexArchiv

  • 最近,我在Flutter中遇到了一个错误: 谢谢。

  • 我在Flutter项目中尝试构建Android应用程序时遇到以下错误 pubspec.yaml档案 Android/build.gradle文件 我认为问题与 ) 有关,但没有在我的应用程序中使用 或也没有使用它,但我仍然收到错误。 构建只是一次又一次地重试,但总是相同的错误。 尝试了这个线程但没有运气