Firebase analytics AppMeasurement not enabled

╄→尐↘猪︶ㄣ 提交于 2019-11-29 01:41:34

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.

In my case, a library I was using was including Firebase but explictly disabling analytics in their manifest.

So I had to override that setting in my AndroidManifest.xml to enable analytics with the following (just before the </application> tag):

<meta-data android:name="firebase_analytics_collection_deactivated" android:value="false"
                   tools:replace="android:value"/>

The above accepted answer got outdated. AppMeasurementService and AppMeasurementReciver is deprectaed and adding it in manifest wont be useful.

Now they support Firebase analytics and recommend to use

implementation 'com.google.firebase:firebase-core:15.0.0'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!