I'm following the Firebase for Flutter code lab and cannot build the app.
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/Users/xxx/development/xxx/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'cloud_firestore' not found
@import cloud_firestore;
~~~~~~~^~~~~~~~~~~~~~~
1 error generated.
env
Xcode: Version 11.3.1 (11C504)
CocoaPod: 1.8.4
-------
VSCode
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.15.3 19D76, locale en-US)
• Flutter version 1.12.13+hotfix.7 at /Users/willjay/development/flutter
• Framework revision 9f5ff2306b (10 days ago), 2020-01-26 22:38:26 -0800
• Engine revision a67792536c
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/willjay/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 43.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.41.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.8.0
[✓] Connected device (1 available)
• iPhone 11 Pro Max • 61D514E8-A82D-4C53-8C57-7115B152C9A6 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
• No issues found!
yaml
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cloud_firestore: ^0.13.0+1
cupertino_icons: ^0.1.2
I figure it out! I think it is a bit confusing when you start setting up firebase.
When starting an iOS project, the instruction on Firebase tells you to use CocoaPod for the setup.
However, flutter handles all these. So, you don't need to Pod init and Pod install anymore.
@Willjay90
Hey, I ran into the same issue.
How did you fix it?
@hrsma2i when you're adding Firebase to your iOS app, you just skip step 3 (Add Firebase SDK) and step 4 (ADD initialization code). The yaml file will handle this part for you.
@Willjay90
I tried the following commands.
flutter clean
rm ios/Pod*
flutter build ios
However there is still the same issue.
Also, you don't need to write any code in AppDelegate.swift
@Willjay90
I didn't edit AppDelegate.swift.
If you see that error in ios, follow the below steps,
1) Open XCode and open the iOS folder as a project there
2) Adding the "GoogleServices-Info.plist" file via "Add Files" (right click on "Runner" in the left bar and choose "Add Files to 'Runner'") => Select the "GoogleServices-Info.plist" file
The app runs on my simulator on my laptop, but it shows the same error when I try to run it on my physical device. Does anyone have that issue?
Remove the pod file, the podlock file and the pods folder. Then run pod deintegrate from the Terminal and build from Flutter tools. And as the previous comment mentioned, don't add anything to the AppDelegate.
This helped me - Make sure you open Runner.xcworkspace and not Runner.xcodeproj as the latter does not have access to Pods.
Thank you @leeprobert & @toolworld, by following your instructions I was able to test my app on my phone 👍🏽
Most helpful comment
@hrsma2i when you're adding Firebase to your iOS app, you just skip step 3 (Add Firebase SDK) and step 4 (ADD initialization code). The yaml file will handle this part for you.