Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am using multiple firebase projects in an Android App. I am getting this error : Missing google_app_id. Firebase Analytics disabled

I have added following code to initialise there projects.

FirebaseOptions options = new FirebaseOptions.Builder()
            .setApplicationId("1:129574837465:android:0123456773a52cf4f6") // Required for Analytics.
            .setApiKey("iubdeibneh8gzDt7Xn9f-jdjjdjdjdj") // Required for Auth.
            .setDatabaseUrl("https://databasename-d7r7.firebaseio.com") // Required for RTDB.
            .build();

FirebaseApp.initializeApp(context /* Context */, options, "secondary");


FirebaseOptions options2 = new FirebaseOptions.Builder()
            .setApplicationId("1:129574837465:android:0123456773a52cf4f6") // Required for Analytics.
            .setApiKey("iubdeibneh8gzDt7Xn9f-jdjjdjdjdj") // Required for Auth.
            .setDatabaseUrl("https://databasename2-d7r7.firebaseio.com") // Required for RTDB.
            .build();

FirebaseApp.initializeApp(context /* Context */, options2, "secondary2");


FirebaseOptions options3 = new FirebaseOptions.Builder()
            .setApplicationId("1:129574837465:android:0123456773a52cf4f6") // Required for Analytics.
            .setApiKey("kjdkj-o_3nk4jn4k3kjk23j") // Required for Auth.
            .setDatabaseUrl("https://databasename3-d7r7.firebaseio.com") // Required for RTDB.
            .build();

FirebaseApp.initializeApp(context /* Context */, options3, "secondary3");

After initialisation my app is running fine. I can use FirebaseAuth, and FirebaseRTDB just fine but it is throwing error when it has to access firebase_Application_Id for analytics.

I have cross checked the ids from google-services.json files of all the projects. I don't know why but it throws error saying:

Missing google_app_id. Firebase Analytics disabled.

I couldn't figure out the root of this error.

like image 951
mark922 Avatar asked Mar 21 '17 12:03

mark922


People also ask

Can a Firebase project have multiple apps?

A Firebase project can have one or more Firebase Apps registered to it (for example, both the iOS and Android versions of an app, or both the free and paid versions of an app).

How do I remove firebase Analytics?

If you need to deactivate Analytics collection permanently in a version of your app, set FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED to YES (Boolean) in your app's Info.


1 Answers

In my case the problem was with incomplete Firebase configuration.

I was missing

buildscript {
    ...
    dependencies {
        ...
        classpath 'com.google.gms:google-services:4.3.3' // google-services plugin
    }
}

allprojects {
    ...
    repositories {
        google()
    }
}

from build.gradle.

And

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

from app/build.gradle.

like image 86
Anton Malyshev Avatar answered Sep 18 '22 19:09

Anton Malyshev