gradle.propertiesに参照する値を定義します。
gradle.properties
fabricApiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
app.gradleのmanifestPlaceholdersを使って変数を登録します。
app.gradle
android {
defaultConfig {
manifestPlaceholders = [fabricApiKey: project.property("fabricApiKey")];
}
}
AndroidManifest.xmlから${fabricApiKey}を参照します。
AndroidManifest.xml
<meta-data
android:name="io.fabric.ApiKey"
android:value="${fabricApiKey}" />