23

I have followed all the instructions for integrating Firebase analytics correctly in my project. But when I enable debug logging to make sure the events are being sent (using instructions from here) I see

E/FA      ( 3556): AppMeasurementReceiver not registered/enabled
E/FA      ( 3556): AppMeasurementService not registered/enabled
E/FA      ( 3556): Uploading is not possible. App measurement disabled

and obviously the events are not being sent.

Again I have followed all the instructions .

Kayvan N
  • 8,108
  • 6
  • 29
  • 38

5 Answers5

35

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.

Kayvan N
  • 8,108
  • 6
  • 29
  • 38
  • 2
    this is it! Even Firebase customer service could not figure out what was wrong in my project settings; and they spent weeks asking questions. How did you figure it out? – eric f. Feb 08 '17 at 00:34
  • 1
    I'm glad it helped you, it took me a while to figure it out as well. – Kayvan N Feb 08 '17 at 03:27
  • 2
    Thanks a lot, you made my day, I was facing same issue from 2 days and was not able to resolve the issue, your solution worked for me. – Deepak May 08 '17 at 20:42
  • 1
    I was struggling with this for days! Thank you very much for your time! You save so much time for me! – Nick May 26 '17 at 08:17
  • Thank you for saving my sanity removing this and adding `tools:node="replace"` to my `com.facebook.FacebookActivity` fixed it for me – Marco Jan 10 '19 at 20:22
  • what is more important is focusing on and resolve conflicts. – vivek_ios Sep 29 '19 at 14:05
15

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" />
ilham suaib
  • 272
  • 3
  • 10
  • 2
    Worked for me @ Android Studio 3.6.3 ; Pixel 3 API 29 Emulator. – HX_unbanned May 21 '20 at 09:05
  • I don't remember which tutorial or code snipped I copied, or what I thought when I did this, but turns out, I added this `meta-data` with value `false`, I removed that `meta-data` and it worked! And it took me days to look for answers! I was checking both build.gradle, proguard, multiple mulitple times! And tried many things, but my issue was right infront of me all this time! – Abu Sufian Mar 18 '23 at 22:13
2

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"/>
Sean Barbeau
  • 11,496
  • 8
  • 58
  • 111
1

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'

Kanishk Gupta
  • 369
  • 2
  • 10
0

None of the other answers worked for me so I'm posting this because this issue was awfully annoying.

In my case, the problem was a disguised version mismatch. It went away when I updated the android:versionName in my manifest to the newest release build's version.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.your.package"
    android:versionCode="100"
    android:versionName="4.0.0"> <!-- Update this -->

...