Installation

dependencies:
  flutter:
    sdk: flutter
  firebase_core: ^1.4.0

Android

Project Setting

Installing Firebase configuration File

android/build.gradle

google - service 버전 확인

buildscript {
  dependencies {
    // ... other dependencies
    classpath 'com.google.gms:google-services:4.3.8'
  }
}

/android/app/build.gradle

apply plugin: 'com.google.gms.google-services'

minSdkVersion 최소 16

호환성 해결

/android/app/build.gradle

android {
    defaultConfig {
        // ...
        minSdkVersion 16
        targetSdkVersion 28
        multiDexEnabled true
    }
}

dependencies {
  implementation 'com.android.support:multidex:1.0.3'
}

Enabling use of Firebase Emulator Suite

android/app/src/debug/AndroidManifest.xml

기존 application android태그안에 usesCleartextTraffic="true" 추가
http 주소 사용가능

<application android:usesCleartextTraffic="true">
  <!-- possibly other elements -->
</application>

Firebase console에서 앱 추가

android 앱에 firebase 추가

앱 등록 - Android 패키지 이름

android/app/build.gradle 의 applicationId

앱 등록 - 디버그 서명 인증서 SHA (Mac version)

터미널
비밀번호 : android

keytool -list -v \
-alias androiddebugkey -keystore ~/.android/debug.keystore

아래의 인증서 지문 복사 , 붙여넣기

구성파일 다운로드

파일은 다운받아 android/app 위치에 저장

FirebaseSDK 추가

android/build.gradle

buildscript {
  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository
  }
  dependencies {
    ...
    // Add this line
    classpath 'com.google.gms:google-services:4.3.8'
  }
}

allprojects {
  ...
  repositories {
    // Check that you have the following line (if not, add it):
    google()  // Google's Maven repository
    ...
  }
}

android/app/build.gradle

apply plugin: 'com.android.application'
// Add this line
apply plugin: 'com.google.gms.google-services'

dependencies {
  // Import the Firebase BoM
  implementation platform('com.google.firebase:firebase-bom:28.2.0')

  // Add the dependency for the Firebase SDK for Google Analytics
  // When using the BoM, don't specify versions in Firebase dependencies
  implementation 'com.google.firebase:firebase-analytics-ktx'

  // Add the dependencies for any other desired Firebase products
  // https://firebase.google.com/docs/android/setup#available-libraries
}

IOS

Firebase console에서 앱 추가

ios 폴더 우클릭으로 xcode에서 열기

Runner 클릭

bundle identifier 부분이 ios 번들 id

대문자가 들어가면 안되니 - 소문자로 변경

com.example.firebaseSetting → com.example.firebase-setting

구성파일 추가

Runner/Runner 위치에 추가

추가한 파일의 client id를 복사해서

Runner / info 의 URL types의 URL schemes에 추가

Enabling use of Firebase Emulator Suite

ios/Runner/Info.plist

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsLocalNetworking</key>
    <true/>
</dict>

pop error

ios 폴더 위치에서 pod install

ios version error

ios deployment target version 변경

Git commit

https://github.com/mugon-dev/flutter_firebase_blog/commit/74b44de7d0320a0085f432b160cfe0c7e42865b3

 

firebase android, ios setting · mugon-dev/flutter_firebase_blog@74b44de

Permalink This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Browse files firebase android, ios setting Loading branch information Showing 13 changed files with 244 additions and 113 deletions.

github.com

 

728x90

+ Recent posts