Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: Firebase Analytics is beeing disabled: Missing google_app_id #210

Closed
1 task done
qwadrox opened this issue Sep 11, 2023 · 13 comments
Closed
1 task done

[bug]: Firebase Analytics is beeing disabled: Missing google_app_id #210

qwadrox opened this issue Sep 11, 2023 · 13 comments
Labels
bug Something isn't working question Further information is requested

Comments

@qwadrox
Copy link

qwadrox commented Sep 11, 2023

Is there an existing issue for this?

  • I have searched the existing issues.

CLI Version

0.2.7

Firebase Tools version

12.5.3

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.13.3, on Microsoft Windows [Version 10.0.22621.2134], locale en-US)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.4)
[✓] Android Studio (version 2022.3)
[✓] VS Code, 64-bit edition (version 1.81.1)
[✓] Connected device (4 available)
[✓] Network resources

Description

Despite following the documentation, using flutterfire cli, Firebase Analytics is beeing disabled: Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI

logs:

/FirebaseApp(  594): Device unlocked: initializing all Firebase APIs for app [DEFAULT]
I/FirebaseCrashlytics(  594): Initializing Firebase Crashlytics 18.4.0 for com.example.firebase_analy_hehe
D/FirebaseSessions(  594): Registering Sessions SDK subscriber with name: CRASHLYTICS, data collection enabled: true
D/FirebaseSessions(  594): Data Collection is enabled for at least one Subscriber
D/EventGDTLogger(  594): Session Event: {"eventType":1,"sessionData":{"sessionId":"c754025e8989428c9fb074fd0744ea35","firstSessionId":"c754025e8989428c9fb074fd0744ea35","sessionIndex":0,"eventTimestampUs":1694365518129000,"dataCollectionStatus":{"performance":2,"crashlytics":2,"sessionSamplingRate":1.0},"firebaseInstallationId":"eZv1uZoNSDSn0RHPMtAegh"},"applicationInfo":{"appId":"1:1050344469051:android:75a9bbbda2eb617926a21e","deviceModel":"M2002J9G","sessionSdkVersion":"1.0.0","osVersion":"12","logEnvironment":3,"androidAppInfo":{"packageName":"com.example.firebase_analy_hehe","versionName":"1.0.0","appBuildVersion":"1","deviceManufacturer":"Xiaomi"}}}
I/SessionCoordinator(  594): Successfully logged Session Start event: c754025e8989428c9fb074fd0744ea35
E/FA      (  594): Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI

Steps to reproduce

Before hand I created a new firebase project, enabled Analytics

  1. Flutter create
  2. Add these:
  firebase_core: 2.15.1
  firebase_crashlytics: 3.3.5
  firebase_analytics: 10.4.5
  firebase_messaging: 14.6.7
  1. Add development SHA fingerprint to firebase
  2. Run:
flutterfire configure --project=flutter-test-bug
  1. Flutter run

Sample project

https://github.com/qwadrox/firebase_flutter_repoduce_bug

Expected behavior

Analytics should be configured correctly.

In case you did the setup with flutter cli, In the message https://goo.gl/NAOOOI URL is missleadiding as it redirects to this page: https://firebase.google.com/docs/android/setup which is configuration for android and NOT flutter.

CLI should add required configuration to build.gradle files.

Screenshots

No response

Additional context and comments

  • Noticed this issue on my production app that has been signed as it should be. After i did this demo.

  • I made a mistake when initializing github repo and I discarded changes, after I created a new project with same name and repeated the steps but CLI didn't add this 2 line:

 // START: FlutterFire Configuration
     classpath 'com.google.gms:google-services:4.3.10'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
 // END: FlutterFire Configuration
  • I added manually at the second time.
    If this is still valid CLI should add them to both build gradle. So this should be added as well in app/build.gradle:
apply plugin: 'com.google.gms.google-services'

Currently it wouldn't add.

@qwadrox qwadrox added bug Something isn't working triage labels Sep 11, 2023
@qwadrox qwadrox changed the title [bug]: Firebase Analytics is beeing disabled: Missing google_app_id. _Firebase Analytics disabled. See https://goo.gl/NAOOOI__ [bug]: Firebase Analytics is beeing disabled: Missing google_app_id Sep 11, 2023
@edimarvirtual
Copy link

Hello, I registered the task #208, but although it is not the same problem, I believe the cause is the same

@qwadrox
Copy link
Author

qwadrox commented Sep 11, 2023

@edimarvirtual Thanks for the quick response.
I forgot the mention this problem exist when target platform is Android.

Please look at these:
firebase_options from my example
firebase_options from firebase_analytics example project

Configuration for android just looks okay.

@qwadrox
Copy link
Author

qwadrox commented Sep 11, 2023

@edimarvirtual

Also I'm seeing this in LogCat:

Default FirebaseApp failed to initialize because no default options were found. This usually means that com.google.gms:google-services was not applied to your gradle project.
FirebaseApp initialization unsuccessful

So indeed the CLI did not add the required gradle configuration.

@edimarvirtual
Copy link

Although this link is obsolete, this guide can help you check what may be missing or incorrect in your project.

It is very useful for checking the settings that must be made in native Flutter projects.

Some things that are in this guide are now done automatically by the CLI, but it might help you

I don't use crashlytics yet, but there are also manual configuration details for everything

consider that some things are obsolete, but I think it can help

https://firebase.flutter.dev/docs/manual-installation/android

@qwadrox
Copy link
Author

qwadrox commented Sep 11, 2023

Thank you for the link. I've already attempted to add the apply plugin inside android/app/build.gradle as stated in my initial post, and could bee see in the obsolete docs. However, I consistently encounter various errors afterwards. This leads me to seek alternative solutions, resulting in further modifications and I end up in a loop. I believe the official documentation should include a section on manual configuration, especially if the CLI is that incomplete. If you recommend.

@qwadrox
Copy link
Author

qwadrox commented Sep 11, 2023

Btw should I open a separate discussion about this:

"In case you did the setup with flutter cli, In the message https://goo.gl/NAOOOI URL is missleadiding as it redirects to this page: https://firebase.google.com/docs/android/setup which is configuration for android and NOT flutter."

Thank you for you time.

@saifulapm
Copy link

Any update on this ? Still getting this issue on android emulator

@qwadrox
Copy link
Author

qwadrox commented Oct 9, 2023

I can only give a hint. The CLI did not work correctly, it didn't add the required configuration to all files, like build.gradle. After updating all files in android dir just like they're in a new flutter project and after browsing flutterfire_cli's source code I could make it work by manually adding what it needs to be there. I use the latest packages from firebase.

@Bridge-Softwares
Copy link

@qwadrox Can you share what config should be added please ? Firebase Analytics is working fine for iOS but not submitting events on Android

@qwadrox
Copy link
Author

qwadrox commented Oct 16, 2023

@qwadrox Can you share what config should be added please ? Firebase Analytics is working fine for iOS but not submitting events on Android

Well in android/build.gradle

buildscript {
    ext.kotlin_version = '1.9.0' //I use 1.9.0 here. I was using 1.8
    
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
        // START: This below: I use 4.4.0 But when I did this post i was using: 4.3.15
        classpath 'com.google.gms:google-services:4.4.0'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
        // END
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

android/app/build.gradle:

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"

    // START: If you use a new flutter project either this or 
    id 'com.google.gms.google-services'
    // END:
}

...

// START: This here 
apply plugin: 'com.google.gms.google-services'
// END: 

android {
    namespace "com.example.company"
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }
...

I hope this helps.

@russellwheatley
Copy link
Member

Hey folks, I would encourage you to use the latest dev version which ought to apply the plugin com.google.gms.google-services.

To install, run:

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

Let me know if that helps you set up your project.

@russellwheatley russellwheatley added question Further information is requested and removed triage labels Oct 19, 2023
@qwadrox
Copy link
Author

qwadrox commented Oct 26, 2023

It did work for me, meaning it added the required gradle config and my original problem has been solved so I'm closing this issue.

Note:
In my original post I drew attention to the fact that there is somewhere a misleading url:

In case you did the setup with flutter cli, In the message https://goo.gl/NAOOOI URL is misleadiding as it redirects to this page: https://firebase.google.com/docs/android/setup which is configuration for android and NOT flutter.

Since my original problem has been solved, Idk is it relevant or not.

@qwadrox qwadrox closed this as completed Oct 26, 2023
@kightsonsanom
Copy link

@russellwheatley I've tried this and it throws error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mapDebugSourceSetPaths'.
> Error while evaluating property 'extraGeneratedResDir' of task ':app:mapDebugSourceSetPaths'
   > Failed to calculate the value of task ':app:mapDebugSourceSetPaths' property 'extraGeneratedResDir'.
      > Querying the mapped value of provider(java.util.Set) before task ':app:processDebugGoogleServices' has completed is not supported

after manually updating classpath to this value it works fine:
classpath 'com.google.gms:google-services:4.3.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants