Firebase analytics AppMeasurement not enabled

Make sure you set mata data at the manifest firebase_analytics_collection_enabled to be true

<meta-data
     android:name="firebase_analytics_collection_enabled"
     android:value="true" />

It turns out that Firebase Library has an Android Manifest file in which it defines these nodes:

 <service android:name="com.google.android.gms.measurement.AppMeasurementService"
     android:enabled="true"
     android:exported="false"/>

 <receiver android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
     android:enabled="true">
     <intent-filter>
         <action android:name="com.google.android.gms.measurement.UPLOAD" />
     </intent-filter>
 </receiver>

based on AppMeasurementService and AppMeasurementReceiver

which are needed for analytics to work and my problem was that I was replacing all the library nodes with <tools:node=”replace”> in my Android Manifest which in turn ignored the needed nodes for analytics lib.

Removing <tools:node=”replace”> and replacing my conflicts specifically solved my problem.