我已经在使用 Flutter 的应用程序上工作了几个月,但是每次升级 Flutter 时,这都是一个巨大的痛苦,因为我必须努力尝试让它重新构建。通常,手动清理 CocoaPods 和 pubspec.yaml 就足够了,但这一次还不够。
我已将 Flutter 版本从 1.10.7 升级到 1.14.6 ,对我的 pods 进行了修改和 pubspec.yaml 破坏了我安装的 Flutter ,我的存储库,但没有任何效果。
另一个奇怪的事情是,我在同一台机器的同一分支上使用相同版本的flutter,dart,cocoapods和ruby运行了正常的构建。我无法正确清理的地方有缓存吗?当我尝试构建时,它说它失败并显示错误,但是不幸的是,日志输出实际上并未显示任何错误,而仅显示警告。这是我的日志输出的一部分:
8 warnings generated.
/Users/hallo/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/ios/Classes/FLTGoogleSignInPlugin.m:138:13: warning: unused variable 'sourceApplication' [-Wunused-variable]
NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
^
/Users/hallo/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/ios/Classes/FLTGoogleSignInPlugin.m:138:41: warning: 'UIApplicationOpenURLOptionsSourceApplicationKey' is only available on iOS 9.0 or newer [-Wunguarded-availability]
NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In module 'UIKit' imported from /Users/hallo/Documents/HalloMonoRepo/hallo/ios/Pods/Target Support Files/google_sign_in/google_sign_in-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:514:51: note: 'UIApplicationOpenURLOptionsSourceApplicationKey' has been marked as being introduced in iOS 9.0 here, but the deployment target is iOS 8.0.0
UIKIT_EXTERN UIApplicationOpenURLOptionsKey const UIApplicationOpenURLOptionsSourceApplicationKey NS_SWIFT_NAME(sourceApplication) API_AVAILABLE(ios(9.0)); // value is an NSString containing the bundle ID of the originating application; non-nil if the originating application and this application share the same team identifier
^
/Users/hallo/Documents/dev/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.1.1/ios/Classes/FLTGoogleSignInPlugin.m:138:41: note: enclose 'UIApplicationOpenURLOptionsSourceApplicationKey' in an @available check to silence this warning
NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Could not build the application for the simulator.
Error launching application on iPhone 8.
由于我已尽我所有可能导致此错误的想法,因此将不胜感激。
Pluto:hallo hallo$ flutter doctor -v
[✓] Flutter (Channel beta, v1.14.6, on Mac OS X 10.14.6 18G3020, locale en-US)
• Flutter version 1.14.6 at /Users/hallo/Documents/dev/flutter
• Framework revision fabeb2a16f (3 weeks ago), 2020-01-28 07:56:51 -0800
• Engine revision c4229bfbba
• Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/hallo/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.0, Build version 11A420a
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 39.0.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.42.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.8.1
[✓] Connected device (1 available)
• iPhone 8 • C40DD8DB-5860-4B94-8D20-372074B6E7BC • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-0 (simulator)
• No issues found!`
答案 0 :(得分:0)
您是否正在Android Studio上运行? VS代码?您能发布您的flutter doctor -v
吗?
除此之外,所有这些错误均来自google_sign_in。将推荐以下内容:
google_sign_in
(并使用此依赖项注释所有屏幕)google_sign_in
可能不是最新的 Flutter 更新。如果您的代码在没有该库的情况下运行,则显然会显示有关最新升级更改的错误。
答案 1 :(得分:0)
我通过更改各种方法解决了该问题。当我执行flutter升级时,它通过添加以下行来更改了我的project.pbxproj文件
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\"${PODS_ROOT}/Fabric/run\"\n";
造成很多错误。我删除了这一行,将Xcode中的构建系统更改为默认值(这是旧系统),然后在Xcode中的嵌入框架中,删除了Flutter.framework。
答案 2 :(得分:0)
只需在您的项目上运行flutter clean
,它就对我有用。