- Create Firebase project
- Add firebase_auth and firebase_core
- Add to
main.dart
:
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
- Get SHA-1 and SHA-256 keys
- Insert the keys in project settings in Firebase Console
- Download
google-services.json
and place it to/android/app/
- Add
classpath 'com.google.gms:google-services:4.3.5'
to/android/build.gradle
dependencies
9a. Optional: to remove captcha
-
enable the Android Device Verification API on google cloud console (left menu --> APIs&Services --> Credentials)
-
add SHA-1 in the EXISTING project on that page (there're will be the one from Firebase). THERE'S NO POINT IN CREATING A NEW PROJECT
-
additionally, for iOS one can use:
await FirebaseAuth.instance.setSettings(appVerificationDisabledForTesting: true);
DON'T FORGET TO REMOVE IT in release version - it won't work
9b. Optional: to enable multidex support
-
add the
google-services
plugin as a dependency inside of the android/build.gradle file:buildscript { dependencies { // ... other dependencies classpath 'com.google.gms:google-services:4.3.3' } }
-
execute the plugin by adding the following underneath the line apply plugin:
com.android.application
, within the/android/app/build.gradle
file:apply plugin: 'com.google.gms.google-services'
-
open the
/android/app/build.gradle
file. Underdependencies
add the multidex module, and enable it within the defaultConfig:android { defaultConfig { // ... minSdkVersion 16 targetSdkVersion 28 multiDexEnabled true } } dependencies { implementation 'com.android.support:multidex:1.0.3' }
- Add app to project in Firebase Console
- Download
GoogleService-Info.plist
and place it in XCode to to Runner -> Runner (next toInfo.plist
) - Set the
MinimumOSversion
to 10.0 in ios/Flutter/AppFrameworkInfo.plist - In Xcode, ensure that at Runner -> Project -> Runner -> Build Settings -> Basic -> Deployment -> iOS Deployment Target is set to 10.0
- In Xcode, ensure that at Runner -> Targets -> Runner -> Build Settings -> Basic -> Deployment -> iOS Deployment Target is set to 10.0
- In Xcode, ensure that at Runner -> Targets -> Runner -> General -> Deployment Info ios is set to 10.0
- In Podfile: uncomment the line
platform :ios, '10.0'
- In Podfile: ensure that it contains the following post install script:
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0' end end end
- Run
flutter clean \ && rm ios/Podfile.lock pubspec.lock \ && rm -rf ios/Pods ios/Runner.xcworkspace
- Run
flutter pub get
- From within
/ios
runpod install
- Do NOT add this line to the end of the file to speed up build:
it's from here
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '6.26.0'