invertase / flutterfire_cli

A CLI to help with using FlutterFire in your Flutter applications.
Apache License 2.0
170 stars 47 forks source link

[bug]: Does not support Plugin DSL when flutterfire configure #261

Closed 2shrestha22 closed 5 months ago

2shrestha22 commented 7 months ago

Is there an existing issue for this?

CLI Version

0.2.7

Firebase Tools version

13.4.0

Flutter Doctor Output

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.19.2, on Arch Linux 6.7.6-arch1-2, locale en_US.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Chrome - develop for the web [✓] Linux toolchain - develop for Linux desktop [✓] Android Studio (version 2023.2) [✓] Connected device (3 available) [✓] Network resources

• No issues found!

Description

When configuring with flutterfire configure on flutter project created with flutter 3.19.2 (uses Plugin DSL) it does not add com.google.gms.google-services or com.google.firebase.crashlytics or anything as dependency.

Steps to reproduce

  1. install latest stable flutter
  2. flutter create my_app
  3. flutterfire configure

Expected behavior

It should add dependency as described here. https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply#google-mobile-services-and-crashlytics

Screenshots

No response

Additional context and comments

No response

callmephil commented 6 months ago

I have the same issue, I had to set up Android on a new project manually.

Here's what worked for me.

./android/settings.gradle

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
    id "org.jetbrains.kotlin.android" version "1.9.0" apply false
    id "com.google.gms.google-services" version "4.3.15" apply false
    id "com.google.firebase.crashlytics" version "2.8.1" apply false
    id "com.google.firebase.firebase-perf" version "1.4.2" apply false
}

Note: the versions might be outdated, it is either that this post is too old or that one is not compatible with others. ex: firebase-perf (1.4.2) is only compatible with google-services:4.3.15 and kotlin (1.9.0)

./android/app/build.gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
    id "com.google.gms.google-services"
    id 'com.google.firebase.crashlytics'
    id 'com.google.firebase.firebase-perf'
}
android {
    ...
    compileSdk 34
    ...
    defaultConfig {
      ...
      minSdkVersion 28
      targetSdkVersion 34
      ...
    }
    ...
}
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0"
    implementation(platform("com.google.firebase:firebase-bom:32.8.0"))
    implementation("com.google.firebase:firebase-analytics")
    implementation("com.google.firebase:firebase-crashlytics")
    implementation("com.google.firebase:firebase-perf")
}

./android/app/src/main/AndroidManifest.xml

<application>
    ....
    <meta-data
      android:name="firebase_performance_logcat_enabled"
      android:value="true" />
    ....
</application>
russellwheatley commented 5 months ago

If you use the latest dev version, this is fixed:

Run to install:

dart pub global activate flutterfire_cli 0.3.0-dev.21 --overwrite

We will be making dev release the general release next week but you can use the above in the interim period.