ismail
ismail

Reputation: 648

Flutter: Missing google_app_id. Firebase Analytics disabled

I want to send a notification from a device to another but when I sent it I got in the receiver device :

D/FLTFireMsgReceiver( 8876): broadcast received for message
E/FA      ( 8876): Missing google_app_id. Firebase Analytics disabled. See ...

enter image description here I searched in the internet but no solution works from me so I add all the verification that I found that they need to be :

In the ProjectName/android/app/Build.gradle :

In the Build.gradle.

In the ProjectName/android/Build.gradle :

enter image description here

And I added the google-services.json in the path "ProjectName/android/app/"

enter image description here

Upvotes: 35

Views: 36324

Answers (16)

I had the same issue with my Flutter app, this is how I fixed it. (my project using Declarative Gradle)

I added these lines inside the plugins block in android/settings.gradle

id "com.google.gms.google-services" version "4.3.15" apply false
id "com.google.firebase.firebase-perf" version "1.4.2" apply false
id "com.google.firebase.crashlytics" version "2.9.8" apply false

this is how my plugins block looks like

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.8.22" apply false

    id "com.google.gms.google-services" version "4.3.15" apply false
    id "com.google.firebase.firebase-perf" version "1.4.2" apply false
    id "com.google.firebase.crashlytics" version "2.9.8" apply false
}

I also add these 2 lines inside plugins block in android/app/build.gradle

id "com.google.gms.google-services"
id "com.google.firebase.crashlytics"

this is how my plugins block looks like now

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"
}

after I added those lines the issue has gone.

Upvotes: 1

Ahmed Elsayed
Ahmed Elsayed

Reputation: 740

  1. Remove the following from the plugins in android/app/build.gradle:

        id 'com.google.gms.google-services'
        // + any other firebase plugins
    
  2. Remove the following from the plugins in android/settings.gradle:

        id "com.google.gms.google-services" version  ....
        // + any other firebase plugins
    
  3. Update flutterfire_cli to the latest version and run flutterfire reconfigure or flutterfire configure ... if it's the first time. It’ll add the plugins again with the proper versions.

Upvotes: 1

Wasib Hussain
Wasib Hussain

Reputation: 256

In my case I had to revert android/build.gradle to

"classpath 'com.google.gms:google-services:4.3.14'"

and it worked perfect.

Upvotes: 2

These versions worked for me.

buildscript {
    ext.kotlin_version = '1.9.24'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.14'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0'
    }
}

Upvotes: 1

Alex
Alex

Reputation: 76

I solved this problem by adding:

  • File android/build.gradle

    plugins {id 'com.google.gms.google-services' version '4.3.15' apply false}

  • File app/build.gradle

    plugins {... id 'com.google.gms.google-services' ...}

Upvotes: 0

Farmz Asia
Farmz Asia

Reputation: 29

after migrate upgrade to flutter 3.19 revert to 4.3.14 version

Upvotes: 3

rapid flutter
rapid flutter

Reputation: 21

Add this line in your settings.gradle file

id("com.google.gms.google-services") version "4.4.1" apply false

If your gradle is not migrated you can migrate it by following link.

Upvotes: 2

Alaa Badr
Alaa Badr

Reputation: 31

just revert to "classpath 'com.google.gms:google-services:4.3.14'" in android/build.girdle

if you are migrating Android ....

in android /settings.gradle add this in plugins

 id("com.google.gms.google-services") version "4.3.14" apply false

Upvotes: 3

Ashim Saha
Ashim Saha

Reputation: 493

To solve this, I have to change the version of com.google.gms.google-services inside the settings.gradle file.

FROM

plugins {
    ...
    id 'com.google.gms.google-services' version '4.4.1' apply false
}

TO

plugins {
    ...
    id 'com.google.gms.google-services' version '4.3.15' apply false
}

Upvotes: 13

pradeep francis
pradeep francis

Reputation: 1

Just deactivate ur flutter cli and activate it f Firebase analytics will be enabled

Upvotes: -1

Han
Han

Reputation: 81

I had similar issue,

Update your app-level build.gradle:

plugins {
    id 'com.google.gms.google-services'  
}

dependencies {
    implementation(platform("com.google.firebase:firebase-bom:32.6.0"))
    implementation("com.google.firebase:firebase-analytics") 
}

Update your project-level build.gradle

dependencies {
        classpath 'com.google.gms:google-services:4.3.14'
}

make sure to use com.google.gms:google-services:4.3.14

Upvotes: 8

Hemant Kaushik
Hemant Kaushik

Reputation: 1754

On my side, the issue was with AndroidManifest.xml file.

I found when I get FirebaseOptions.fromResource(context) it was returning null.

It was happening because default FirebaseOptions config picks package name from AndroidManifest.xml file. It was missing when I created new Flutter app.

Make sure that the package attribute is there in the manifest tag.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.beautiful.app">

Upvotes: 3

lewiseman
lewiseman

Reputation: 590

I had configured firebase with the help of flutterfire and thats when i started to see the error .

I added the Google services plugin in android/app/build.gradle which now looks like this :

plugins {
    id "com.android.application"
    id 'com.google.gms.google-services'
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

Also not sure if it helps updated my Project level android/build.gradle Gradle file

From: classpath com.android.tools.build:gradle:7.3.1

To: classpath com.android.tools.build:gradle:7.4.2

Also remember to gradle sync your project .

With that my firebase analytics started working .

Upvotes: 14

Pedro Massango
Pedro Massango

Reputation: 5015

For Flutter devs: I only needed to upgrade my Gradle dependency

From: classpath 'com.android.tools.build:gradle:7.3.1'

To: classpath 'com.android.tools.build:gradle:7.4.2'

Then sync your Gradle file.

Upvotes: 15

Dinei
Dinei

Reputation: 5444

I had this issue, and the solution was adding this line:

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

In android/app/build.gradle, after the first apply plugin command.

My final app/build.gradle looks like this:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

Upvotes: 8

ismail
ismail

Reputation: 648

The problem is the API Firebase Analytics is not installed so if you need to install it and activate it :

You must follow Literally the SDK setup and configuration of google: enter image description here

enter image description here

enter image description here

Then restart your Pc or Mac.

Upvotes: 5

Related Questions