Adding Firebase Crashlytics to an Android app

I’ve been running into an issue adding Firebase and finally traced the cause back to this. When I run my project that includes Firebase, the following runtime error shows up in Logcat:

Failed to retrieve Firebase Instance ID

I used Android Studio’s APK Analyzer tool to compare the final merged manifests of my EBuild app and an equivalent app built in Android Studio (the ADS app is working as expected). The manifests are almost identical, with a couple key exceptions on ComponentDiscoveryService.

EBuild Manifest:

<service
    android:name="com.google.firebase.components.ComponentDiscoveryService"
    android:exported="false">

        <meta-data
            android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
            android:value="com.google.firebase.components.ComponentRegistrar" />
</service>

ADS Manifest:

<service
	android:name="com.google.firebase.components.ComponentDiscoveryService"
	android:exported="false"
	android:directBootAware="true">

	<meta-data
		android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
		android:value="com.google.firebase.components.ComponentRegistrar" />

	<meta-data
		android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
		android:value="com.google.firebase.components.ComponentRegistrar" />
</service>

The ADS manifest adds the directBootAware attribute. This comes from the firebase-common package. My EBuild log shows this message:

W: Skipped adding Android service 'com.google.firebase.components.ComponentDiscoveryService' from reference 'firebase-common-19.3.0', because it already exists.

I can’t locate the GitHub directory where the firebase.iid.Registrar meta-data is coming from, but I’m sure this is what’s causing the “Failed to retrieve ID” error. My EBuild log also shows:

W: Skipped adding Android service 'com.google.firebase.components.ComponentDiscoveryService' from reference 'firebase-iid-20.1.5', because it already exists.

It looks like duplicates need to be merged, not skipped.