升级 Flutter 后存在许多依赖项问题



我试图更新我的颤振版本。我运行flutter upgrade,之后我收到了很多错误。在那之后,我尝试了很多其他命令,我什至不记得所有命令。我修复了一些错误,但每次发生其他错误时。现在我似乎很多依赖项与我当前的颤振版本不兼容。

flutter doctor说我在版本:主人,v1.1.10-pre.44


Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    === BUILD TARGET firebase_core OF PROJECT Pods WITH CONFIGURATION Debug ===
    /Users/jonas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.7.0/ios/Classes/FirebaseAuthPlugin.m:15:36: error: use of undeclared identifier 'FIRAuthErrorNameKey'; did you mean 'FIRAuthErrorDomain'?
      NSString *code = [self userInfo][FIRAuthErrorNameKey];
                                       ^~~~~~~~~~~~~~~~~~~
                                       FIRAuthErrorDomain
    In module 'FirebaseAuth' imported from /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/Headers/Public/Firebase/Firebase.h:12:
    /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/FirebaseAuth/Firebase/Auth/Source/Public/FIRAuthErrors.h:45:24: note: 'FIRAuthErrorDomain' declared here
    extern NSString *const FIRAuthErrorDomain NS_SWIFT_NAME(AuthErrorDomain);
                           ^
    /Users/jonas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.7.0/ios/Classes/FirebaseAuthPlugin.m:83:9: warning: 'signInAndRetrieveDataWithCredential:completion:' is deprecated: Please use signInWithCredential:completion: for Objective-C or signIn(with:completion:) for Swift instead. [-Wdeprecated-declarations]
            signInAndRetrieveDataWithCredential:[self getCredential:call.arguments]
            ^
    In module 'FirebaseAuth' imported from /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/Headers/Public/Firebase/Firebase.h:12:
    /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/FirebaseAuth/Firebase/Auth/Source/Public/FIRAuth.h:458:1: note: 'signInAndRetrieveDataWithCredential:completion:' has been explicitly marked deprecated here
    DEPRECATED_MSG_ATTRIBUTE("Please use signInWithCredential:completion: for Objective-C or "
    ^
    In module 'UIKit' imported from /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/Target Support Files/firebase_auth/firebase_auth-prefix.pch:2:
    In module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
    In module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/AvailabilityMacros.h:179:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
                #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
                                                                   ^
    /Users/jonas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.7.0/ios/Classes/FirebaseAuthPlugin.m:99:9: warning: 'fetchProvidersForEmail:completion:' is deprecated: Please use fetchSignInMethodsForEmail:completion: for Objective-C or fetchSignInMethods(forEmail:completion:) for Swift instead. [-Wdeprecated-declarations]
            fetchProvidersForEmail:email
            ^
    In module 'FirebaseAuth' imported from /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/Headers/Public/Firebase/Firebase.h:12:
    /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/FirebaseAuth/Firebase/Auth/Source/Public/FIRAuth.h:334:1: note: 'fetchProvidersForEmail:completion:' has been explicitly marked deprecated here
    DEPRECATED_MSG_ATTRIBUTE("Please use fetchSignInMethodsForEmail:completion: for Objective-C or "
    ^
    In module 'UIKit' imported from /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/Target Support Files/firebase_auth/firebase_auth-prefix.pch:2:
    In module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
    In module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/AvailabilityMacros.h:179:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
                #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
                                                                   ^
    /Users/jonas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.7.0/ios/Classes/FirebaseAuthPlugin.m:151:38: error: incompatible block pointer types sending 'void (^)(NSError * _Nullable __strong)' to parameter of type 'FIRAuthDataResultCallback _Nullable' (aka 'void (^)(FIRAuthDataResult * _Nullable __strong, NSError * _Nullable __strong)')
                              completion:^(NSError *_Nullable error) {
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In module 'FirebaseAuth' imported from /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/Headers/Public/Firebase/Firebase.h:12:
    /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/FirebaseAuth/Firebase/Auth/Source/Public/FIRUser.h:260:74: note: passing argument to parameter 'completion' here
                              completion:(nullable FIRAuthDataResultCallback)completion;
                                                                             ^
    /Users/jonas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.7.0/ios/Classes/FirebaseAuthPlugin.m:157:28: error: incompatible block pointer types sending 'void (^)(FIRUser *__strong, NSError *__strong)' to parameter of type 'FIRAuthDataResultCallback _Nullable' (aka 'void (^)(FIRAuthDataResult * _Nullable __strong, NSError * _Nullable __strong)')
                    completion:^(FIRUser *user, NSError *error) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In module 'FirebaseAuth' imported from /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/Headers/Public/Firebase/Firebase.h:12:
    /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/FirebaseAuth/Firebase/Auth/Source/Public/FIRUser.h:360:64: note: passing argument to parameter 'completion' here
                    completion:(nullable FIRAuthDataResultCallback)completion;
                                                                   ^
    /Users/jonas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.7.0/ios/Classes/FirebaseAuthPlugin.m:263:30: error: incompatible block pointer types sending 'void (^)(FIRUser * _Nullable __strong, NSError * _Nullable __strong)' to parameter of type 'FIRAuthDataResultCallback _Nullable' (aka 'void (^)(FIRAuthDataResult * _Nullable __strong, NSError * _Nullable __strong)')
                      completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In module 'FirebaseAuth' imported from /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/Headers/Public/Firebase/Firebase.h:12:
    /Users/jonas/Projects/ProjectFit/mobile/project_fit_flutter/ios/Pods/FirebaseAuth/Firebase/Auth/Source/Public/FIRAuth.h:500:66: note: passing argument to parameter 'completion' here
                      completion:(nullable FIRAuthDataResultCallback)completion;
                                                                     ^
    /Users/jonas/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.7.0/ios/Classes/FirebaseAuthPlugin.m:287:62: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      userData[@"lastSignInTimestamp"] = [NSNumber numberWithInt:lastSignInDate];
                                         ~                       ^~~~~~~~~~~~~~
    3 warnings and 4 errors generated.
Could not build the application for the simulator.
Error launching application on iPhone 6.
Exited (sigterm)

这些是我的依赖关系:

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
  # firebase_core: ^0.3.0
  firebase_core: ^0.2.5
  cloud_firestore: ^0.8.0
  firebase_auth: ^0.7.0
  google_sign_in: ^4.0.1+1
  rxdart: ^0.20.0
  shared_preferences: ^0.4.3
  carousel_slider: ^1.0.1
  json_annotation: ^2.0.0
  audioplayers: ^0.7.8
  intl: ^0.15.7
  video_player: "0.10.0"
  url_launcher: ^4.0.3
  # charts_flutter: ^0.5.0
  charts_flutter: ^0.6.0
  flutter_cache_manager: ^0.2.0+1
  flutter_html: ^0.9.3
  flutter_tts: "0.2.1"
  font_awesome_flutter: ^8.4.0
  timeline_list: ^0.0.3
  card_settings: ^1.4.1
dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^1.0.0
  json_serializable: ^2.0.0
  flutter_launcher_icons: ^0.7.0
  #To create JSON methods run:
  # flutter packages pub run build_runner build

问题是,当我尝试更新软件包版本时,我收到如下错误:

The current Flutter SDK version is 1.1.10-pre.44.
Because project_fit_flutter depends on video_player >=0.10.1+3 which requires Flutter SDK version >=1.5.0 <2.0.0, version solving failed.
pub get failed (1)

任何想法如何解决所有这些问题?我很迷茫的自动取款机...

我在最后的评论中看到的是,您的pubspec.yaml中的依赖项正在破坏您的项目。您的 Flutter 对于您的video_player包来说不够最新。当我运行颤振医生时,这是我得到的版本控制信息。

Flutter (Channel stable, v1.7.8+hotfix.3, on Mac OS X 10.14.5 18F2058, locale en-US)
    • Flutter version 1.7.8+hotfix.3 at /Users/duffette/flutter
    • Framework revision b712a172f9 (3 weeks ago), 2019-07-09 13:14:38 -0700
    • Engine revision 54ad777fd2
    • Dart version 2.4.0

也许这个关于升级颤振的页面会有所帮助。知道你在哪个频道吗?https://flutter.dev/docs/development/tools/sdk/upgrading

最新更新