Integrating firebase services
Create a new firebase project
In the project settings > General > Add App, register a new platform (android)
Download google-services.json file and put it under android->app in the Flutter project
//Add the following lines in the project level build.gradle (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.3'
}
}
allprojects {
...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
...
}
}
//Add the following lines in the app level build.gradle (android > app > build.gradle)
apply plugin: 'com.android.application'
// Add this line
apply plugin: 'com.google.gms.google-services'
dependencies {
// add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.2'
// add SDKs for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
}
Note : Make sure that your flutter project enable multi dex build options
Change the minSdkVersion to 21 and add multiDexEnabled true in the (android > app > build.gradle)
Download flutter firebase_analytics plugin
https://pub.dev/packages/firebase_analytics#-readme-tab-
and run it. .that's all
Download flutter firebase_crashlytics plugin
https://pub.dev/packages/firebase_crashlytics#-readme-tab-
In the project settings > General > Add App, register a new platform (android)
Download google-services.json file and put it under android->app in the Flutter project
//Add the following lines in the project level build.gradle (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.3'
}
}
allprojects {
...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
...
}
}
//Add the following lines in the app level build.gradle (android > app > build.gradle)
apply plugin: 'com.android.application'
// Add this line
apply plugin: 'com.google.gms.google-services'
dependencies {
// add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.2'
// add SDKs for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
}
Note : Make sure that your flutter project enable multi dex build options
Change the minSdkVersion to 21 and add multiDexEnabled true in the (android > app > build.gradle)
defaultConfig { applicationId "com.JoyDash.LearnEnglish" minSdkVersion 21 targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName multiDexEnabled true}
Integrating firebase analytics
Download flutter firebase_analytics plugin
https://pub.dev/packages/firebase_analytics#-readme-tab-
and run it. .that's all
Integrating firebase crashnalytics
Download flutter firebase_crashlytics plugin
https://pub.dev/packages/firebase_crashlytics#-readme-tab-
- Add the Fabric repository to the
[project]/android/build.gradle
file.
repositories {
google()
jcenter()
// Additional repository for fabric resources
maven {
url 'https://maven.fabric.io/public'
}
}
- Add the following classpaths to the
[project]/android/build.gradle
file.
dependencies {
// Example existing classpath
classpath 'com.android.tools.build:gradle:3.2.1'
// Add the google services classpath
classpath 'com.google.gms:google-services:4.3.0'
// Add fabric classpath
classpath 'io.fabric.tools:gradle:1.26.1'
}
- Apply the following plugins in the
[project]/android/app/build.gradle
file.
// ADD THIS AT THE BOTTOM
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
Comments
Post a Comment