5

编辑 3这一定是font_awesome_flutter问题。当我离开dependency_overridespubspec.yaml删除 font_awesome_flutter 参数时,只需执行以下操作:

dependency_overrides:

有用。

我升级到颤振 2.0,现在当我尝试运行时出现此错误flutter pub run build_runner watch --delete-conflicting-outputs

The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65

知道如何解决吗?我跑过很多次flutter pub getpub get

pubspec.yaml:

    name: vepo
description: The Vepo mobile app.
publish_to: "none"
version: 1.0.0+1

environment:
  sdk: '>=2.12.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  animate_do: ^2.0.0
  cloud_firestore: ^1.0.1
  dio: ^4.0.0
  enum_to_string: ^2.0.1
  firebase_analytics: ^7.1.1
  firebase_auth: ^1.0.1
  firebase_core: ^1.0.1
  flash: ^1.5.1
  flutter_hooks: ^0.16.0
  flutter_icons: ^1.1.0
  flutter_launcher_icons: ^0.9.0
  flutter_native_splash: ^1.1.7+1
  flutter_riverpod: ^0.13.1+1
  flutter_typeahead: ^3.1.1
  font_awesome_flutter: ^9.0.0
  freezed: ^0.14.1+2
  freezed_annotation: ^0.14.1
  google_fonts: ^2.0.0
  google_maps_webservice: ^0.0.20-nullsafety.2
  hive: ^2.0.2
  hive_flutter: ^1.0.0
  hive_generator: ^1.0.1
  hooks_riverpod: ^0.13.1+1
  http: ^0.13.1
  image_cropper: ^1.4.0
  image_picker: ^0.7.4
  json_annotation: ^4.0.1
  json_serializable: ^4.1.0
  keyboard_avoider: ^0.1.2
  logger: ^1.0.0
  reactive_forms: ^10.0.3
  rxdart: ^0.26.0
  smooth_page_indicator: ^0.2.3
  uuid: ^3.0.3

dependency_overrides:
  font_awesome_flutter:
    path: /Users/benjaminfarquhar/dev/font_awesome_flutter-master

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^1.11.1
  flutter_gen: ^3.0.2
  pedantic: ^1.11.0

flutter:
  uses-material-design: true
  fonts:
    - family: VarelaRound
      fonts:
        - asset: assets/fonts/VarelaRound-Regular.ttf
    - family: Hind
      fonts:
        - asset: assets/fonts/Hind-Medium.ttf
  assets:
    - assets/images/

flutter_gen:
  output: lib/

flutter_icons:
  image_path: "assets/images/launcher_icon_ios.webp"
  android: false
  ios: true

flutter_native_splash:
  image: assets/images/splash_screen.png
  color: "#22F2A6"

添加--verboseflutter pub run build_runner build

[ +114 ms] executing: [/Users/benjaminfarquhar/development/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[  +71 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
[        ] executing: [/Users/benjaminfarquhar/development/flutter/] git tag --points-at
c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
[  +27 ms] Exit code 0 from: git tag --points-at c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
[        ] 2.0.1
[  +59 ms] executing: [/Users/benjaminfarquhar/development/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +15 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/Users/benjaminfarquhar/development/flutter/] git ls-remote --get-url origin
[  +15 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +71 ms] executing: [/Users/benjaminfarquhar/development/flutter/] git rev-parse --abbrev-ref HEAD
[  +30 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[   +9 ms] executing: sw_vers -productName
[  +21 ms] Exit code 0 from: sw_vers -productName
[        ] macOS
[        ] executing: sw_vers -productVersion
[  +20 ms] Exit code 0 from: sw_vers -productVersion
[        ] 11.2.2
[        ] executing: sw_vers -buildVersion
[  +24 ms] Exit code 0 from: sw_vers -buildVersion
[        ] 20D80
[   +9 ms] executing: sysctl hw.optional.arm64
[  +12 ms] Exit code 1 from: sysctl hw.optional.arm64
[        ] sysctl: unknown oid 'hw.optional.arm64'
[  +98 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +58 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[  +49 ms] Using /Users/benjaminfarquhar/development/flutter/.pub-cache for the pub cache.
[        ] executing: /Users/benjaminfarquhar/development/flutter/bin/cache/dart-sdk/bin/pub run build_runner --verbose
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
[ +621 ms] "flutter run" took 755ms.
[  +24 ms] pub finished with exit code 65
[  +17 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _DefaultPub.interactively (package:flutter_tools/src/dart/pub.dart:364:7)
           <asynchronous suspension>
           #2      PackagesForwardCommand.runCommand (package:flutter_tools/src/commands/packages.dart:238:5)
           <asynchronous suspension>
           #3      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1157:12)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart:1009:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
           <asynchronous suspension>
           #7      CommandRunner.runCommand (package:args/command_runner.dart:197:13)
           <asynchronous suspension>
           #8      FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:278:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
           <asynchronous suspension>
           #11     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:234:5)
           <asynchronous suspension>
           #12     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
           <asynchronous suspension>
           #13     run.<anonymous closure> (package:flutter_tools/runner.dart:62:12)
           <asynchronous suspension>
           #14     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #15     AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
           <asynchronous suspension>
           #16     runInContext (package:flutter_tools/src/context_runner.dart:73:10)
           <asynchronous suspension>
           #17     main (package:flutter_tools/executable.dart:90:3)
           <asynchronous suspension>
           
           
[ +265 ms] ensureAnalyticsSent: 254ms
[   +3 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 65
4

3 回答 3

4

您在这里的问题可能与以下导入有关

  flutter_gen: ^3.0.2

我在这里的分析是dependency_overrides在另一个包上使用实现(我使用了 image_cropper),我遇到了完全相同的问题。

我没有使用这个库,所以我不能帮助你更多,但我看到官方 Flutter Github 上提到这个库的问题以及它在编辑 pubspec 文件时可能产生的问题。

编辑
由于将来可能对很多人有帮助,我在flutter_gen Github上创建了一个问题

编辑 2
包 的贡献者flutter_gen回答了 Github 问题。
您必须将flutter_gen导入替换为flutter_gen_runner.

flutter_gen_runner: ^3.0.2
于 2021-04-04T08:15:53.280 回答
2

试试下面的命令

flutter pub cache repair
于 2021-03-06T20:30:45.150 回答
0

尝试以下几行

flutter_icons: android: true ios: true image_path: "assets/logo/cup.png" adaptive_icon_background : "#fff" adaptive_icon_foreground : "assets/logo/cup.png"

我创建了“assets”文件夹并放置了“cup.png”(任何图标图像)

于 2021-07-24T03:41:44.663 回答