Flutter iOS构建时间太长(带有Firebase依赖项)

huangapple go评论64阅读模式
英文:

Flutter iOS build takes forever (with firebase dependencies)

问题

我正在使用Firebase/Firestore制作一个小应用程序来学习,自从添加了Firebase组件后,iOS版本的应用程序构建时间变得非常长。

我看到了一些帖子提到过这个问题,但我找不到确定的答案。有任何想法如何解决吗?干净的构建需要10分钟以上,简直无法使用。

谢谢!

我的pubspec.yaml文件的依赖项:

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  firebase_core: ^2.4.1
  firebase_auth: ^4.2.5
  cloud_firestore: ^4.3.1
  get_it: ^7.2.0
  firebase_storage: ^11.0.10
  path_provider: ^2.0.12
  open_filex: ^4.3.2

Flutter医生的输出:

[✓] Flutter (Channel stable, 3.7.0, on macOS 12.6 21G115 darwin-x64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[!] Android Studio (version 2022.1)
    ✗ 无法找到捆绑的Java版本。
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Community Edition (version 2022.3.1)
[✓] VS Code (version 1.74.2)
[✓] 已连接设备 (共 2 个可用)
[✓] HTTP主机可用性
英文:

I'm making a small app using firebase/firestore to learn, and since adding the firebase components, build times have been insanely long for the iOS version of the App.

I've seen a few post mentionning that but I couldn't find definitive answers.
Any idea how to fix this? A clean build takes 10+ min, it's unusable.

Thanks in advance !

My pubspec.yaml's dependencies:

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  firebase_core: ^2.4.1
  firebase_auth: ^4.2.5
  cloud_firestore: ^4.3.1
  get_it: ^7.2.0
  firebase_storage: ^11.0.10
  path_provider: ^2.0.12
  open_filex: ^4.3.2

Flutter doctor output:

[✓] Flutter (Channel stable, 3.7.0, on macOS 12.6 21G115 darwin-x64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[!] Android Studio (version 2022.1)
    ✗ Unable to find bundled Java version.
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Community Edition (version 2022.3.1)
[✓] VS Code (version 1.74.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

答案1

得分: 1

使用预构建的Firebase SDK:Firebase为iOS提供了预构建的SDK,您可以在Flutter项目中使用它们。这可以帮助减少构建时间,因为您不必自己构建Firebase SDK。您可以在官方文档中找到有关如何使用预构建Firebase SDK的更多信息。

例如,您可以检查此存储库以获取Firestore预构建SDK:

https://github.com/invertase/firestore-ios-sdk-frameworks

英文:

Use pre-built Firebase SDKs: Firebase provides pre-built SDKs for iOS that you can use in your Flutter project. This can help reduce build times as you won't have to build the Firebase SDKs yourself. You can find more information on how to use pre-built Firebase SDKs in the official documentation.

For example, you can check this repo for Firestore pre-built sdk

https://github.com/invertase/firestore-ios-sdk-frameworks

huangapple
  • 本文由 发表于 2023年2月18日 02:39:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/75488141.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定