Firebase Google Analytics with custom FirebaseOptions initilaize method
I know it is not the answer you were expecting but the sad reality is that you can't dynamically initialize your Firebase Analytics.
In official Firebase repository you can see issue https://github.com/firebase/quickstart-android/issues/769 and there the official answer is "this is currently working as intended, the Analytics SDK does not allow configuration of the App ID at runtime". I don't believe it changed since then.
I know that these posts may sound confusing in that context: https://firebase.googleblog.com/2017/03/take-control-of-your-firebase-init-on.html https://firebase.google.com/docs/projects/multiprojects
But intended use case is having different
FirebaseApp configuration (for different databases, for example) and not different
FirebaseAnalytics configuration. And Firebase Analytics is just one of many products under Firebase.
So you don't need to use gradle plugin, but you still need to have String resource called
google_app_id that contains your Firebase App Id and only that will be used to configure FirebaseAnalytics.
It doesn't mean that dynamic initialization of FirebaseAnalytics can't be done at all, but it would require reverse engineering, hacky solution and it would be fragile - in short, probably not a good idea.
I'm not sure what is your use case but if you only want to delay Firebase Analytics initilization, you could consider disabling it at the beginning: https://firebase.google.com/docs/analytics/configure-data-collection?platform=android