Init firebase with FirebaseOptions

Viewed 6275

I want to initialise Firebase with FirebaseOptions without google-services.json, I'm following the blog post here https://firebase.googleblog.com/2017/03/take-control-of-your-firebase-init-on.html.

I removed the FirebaseInitProvider.

<provider
    android:name="com.google.firebase.provider.FirebaseInitProvider"
    android:authorities="${applicationId}.firebaseinitprovider"
    tools:node="remove"/>

I am trying to set the default FirebaseApp in the Application subclass:

FirebaseOptions options = new FirebaseOptions.Builder()
                .setApplicationId("valid_app_id")
                .setGcmSenderId("valid_gcm_sender_id")
                .setApiKey("valid_api_key")
                .build();

FirebaseApp.initializeApp(getApplicationContext(), options);

It seems everything ok, but when I want to log some events to FirebaseAnalytics, then I get this error: Missing google_app_id. Firebase Analytics disabled. I have no idea what is the problem.

1 Answers
Related