Gum*_*dum 2 ios dart firebase visual-studio-code flutter
我正在使用 macOS Big Sur、Visual Studio Code 和当前稳定的 Flutter 版本。
\nflutter clean, rm -rf Pods Podfile.lock; \nflutter pub get; pod init; pod update; \npod install; turned it off and back on; \npulled it out and blew on it then stuck it back in\n
Run Code Online (Sandbox Code Playgroud)\n我的 Podfile 已针对当前 ios 进行更新,并且我已将“GoogleService-Info.plist”文件复制到几乎每个目录,包括 Runner/ lib/ main、Flutter/ 等。
\n我已经重新启动了我的 mac 和 vs code 几次,检查了 pubspec.yaml 的准确性,从冻结状态重新运行自动生成的文件。
\n使用 Visual Studio 和 Xcode 中的 iPhone 12 模拟器编译 ios 时会出现此错误。
\n使用 Visual Studio 和 Android Studio 中的 Pixel 3 模拟器编译 Android 时,不会发生错误,并且程序可以按预期编译/运行。
\n我还没有在 XCode 上尝试过这种编译 - 我更喜欢在 Mac 上使用 VSCode,并且希望保留适用于所有平台的同一个开发程序环境(Visual Studio Code)
\n我在编译时收到的错误是:
\nLaunching lib/main.dart on iPhone 12 in debug mode...\npackage:notes2/main.dart:1\nXcode build done. 62.0s\n7.3.0 - [Firebase/Core][I-COR000012] Could not locate configuration file: \'GoogleService-Info.plist\'.\nConnecting to VM Service at ws://127.0.0.1:51910/4RdXrGyMG2A=/ws\n7.3.0 - [Firebase/Core][I-COR000005] No app has been configured yet.\n[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized. Have you added the "GoogleService-Info.plist" file to the project?\nView the iOS Installation documentation for more information: https://firebase.flutter.dev/docs/installation/ios\n#0 MethodChannelFirebase.initializeApp\npackage:firebase_core_platform_interface/\xe2\x80\xa6/method_channel/method_channel_firebase.dart:88\n<asynchronous suspension>\n#1 Firebase.initializeApp\npackage:firebase_core/src/firebase.dart:41\n<asynchronous suspension>\n#2 main\npackage:notes2/main.dart:13\n<asynchronous suspension>\n
Run Code Online (Sandbox Code Playgroud)\n我已经彻底浏览了 iOS 安装文档,但它没有说明该文件的放置位置或 Visual Studio 代码开发环境的任何环境变量设置。
\n任何有使用 VSCode 进行此操作的经验的人都将不胜感激。我确信它在 mac 上的 XCode 中工作得很好。
\n我的 Podfile
\nplatform :ios, \'14.0\'\n\n# CocoaPods analytics sends network stats synchronously affecting flutter build latency.\nENV[\'COCOAPODS_DISABLE_STATS\'] = \'true\'\n\nproject \'Runner\', {\n \'Debug\' => :debug,\n \'Profile\' => :release,\n \'Release\' => :release,\n}\n\ndef flutter_root\n generated_xcode_build_settings_path = File.expand_path(File.join(\'..\', \'Flutter\', \'Generated.xcconfig\'), __FILE__)\n unless File.exist?(generated_xcode_build_settings_path)\n raise "#{generated_xcode_build_settings_path} must exist. If you\'re running pod install manually, make sure flutter pub get is executed first"\n end\n\n File.foreach(generated_xcode_build_settings_path) do |line|\n matches = line.match(/FLUTTER_ROOT\\=(.*)/)\n return matches[1].strip if matches\n end\n raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"\nend\n\nrequire File.expand_path(File.join(\'packages\', \'flutter_tools\', \'bin\', \'podhelper\'), flutter_root)\n\nflutter_ios_podfile_setup\n\ntarget \'Runner\' do\n flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))\nend\n\npost_install do |installer|\n installer.pods_project.targets.each do |target|\n flutter_additional_ios_build_settings(target)\n end\nend\n
Run Code Online (Sandbox Code Playgroud)\n我的 pubspec.yaml 文件
\nname: notes2\ndescription: A new Flutter project.\n\npublish_to: "none" # Remove this line if you wish to publish to pub.dev\n\nversion: 1.0.0+1\n\nenvironment:\n sdk: ">=2.12.0 <3.0.0"\n\ndependencies:\n flutter:\n sdk: flutter\n another_flushbar: 1.10.17\n cupertino_icons: 1.0.2\n dfunc: 0.6.2\n firebase_auth: 1.0.1\n firebase_core: 1.0.2\n flutter_bloc: 7.0.0\n freezed_annotation: 0.14.1\n get_it: 6.0.0\n google_sign_in: 5.0.1\n injectable: 1.2.2\n oxidized: 4.1.0\n uuid: 3.0.2\ndev_dependencies:\n flutter_test:\n sdk: flutter\n build_runner: 1.12.2\n freezed: 0.14.1+1\n injectable_generator: 1.2.2\n lint: 1.5.3\n\nflutter:\n\n uses-material-design: true\n\n assets:\n - GoogleService-Info.plist\n
Run Code Online (Sandbox Code Playgroud)\n
我不知道您是否从 VS 代码添加“GoogleService-Info.plist”,但您必须使用 Xcode 添加此文件
要做到这一点:
归档时间: |
|
查看次数: |
5904 次 |
最近记录: |