【发布时间】:2016-03-31 10:42:19
【问题描述】:
这是一个自我回答的问题,分享我的知识。
我有一个包含多种产品风格的项目,我想为每种产品风格使用不同的组织来集成 Fabric。
我尝试使用 Android Studio Fabric 插件集成 Fabric。它增加了
<meta-data
android:name="io.fabric.ApiKey"
android:value="DEFAULT_ORGANIZATION_API_KEY" />
AndroidManifest.xml 的 main 源集的条目。
我决定在应用程序变体特定的源集中重写此条目:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application>
<meta-data
android:name="io.fabric.ApiKey"
android:value="SECOND_ORGANIZATION_API_KEY"
tools:replace="android:value" />
</application>
</manifest>
然后我发现 Fabric Gradle 插件在构建过程中生成了 crashlytics.properties 带有结构 api 秘密(AKA 构建秘密)的文件,我应该将此文件包含到源代码控制中。但是每次我构建特定的应用程序变体时,这个文件都会被覆盖,因为每个应用程序的 api secret 都是唯一的。
如何为每个应用程序变体使用不同的组织来集成 Fabric?
【问题讨论】:
标签: android gradle crashlytics twitter-fabric android-productflavors