I am trying to integrate my application developed on Flutter with Firebase, however while following the tutorial, I’m facing some issues.
Copying exact thing from Firebase documentation:
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
id("com.google.gms.google-services:4.3.15") version "4.3.15" apply false
}
Updating them with some solutions found:
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms.google-services:4.3.15'
}
I’m still facing the issue in Build. I have also checked the google-services.json file which is in app folder and the build gradle inside it looks like:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation(platform("com.google.firebase:firebase-bom:32.1.1"))
}
2
Answers
I don’t think you need to edit your
build.gradle
files manually to add firebase to your Flutter project nowadays. Use the Firebase CLI instead, just follow the instructions on this page:Add Firebase to your Flutter app
This is what I did last time, and I had no problems at all.
Use Firebase CLI to integrate flutter with firebase. See there documentation and follow step by step. Links: https://firebase.google.com/docs/cli#sign-in-test-cli