I just looked into this pretty closely. This doesn't work because the android:value
attribute is taken literally. To use a resource id you'd have to use android:resource
attribute instead but the Fabric gradle plugin does not make use of this android:resource
attribute at all because it processes the manifest as an XML document rather than as an Android Manifest class.
After decompiling the Fabric source code and figuring out how the DefaultManifestData
and StandardAndroidProject
classes work, I confirmed the following:
The Easiest Way to Provide a Separate ApiKey for Debug Builds
Leverage manifest merging by creating app/src/debug/AndroidManifest.xml
with the following contents (you must use the tools:replace
attribute for this to work):
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application>
<!-- Meta-data -->
<meta-data
android:name="io.fabric.ApiKey"
android:value="[yourDebugApiKey]"
tools:replace="android:value"/>
</application>
</manifest>
Your debug ApiKey is located in your project's Organization Settings page.