【发布时间】:2017-07-30 10:49:25
【问题描述】:
多年来,我一直非常小心地不将 Google-Android 依赖项引入我的 Android 应用程序,并且有两种风格保持这种隔离,withAmazon 和 withGoogle。
app
|_ main
|_ test
|_ withAmazon
|_ withGoogle
最近,我一直在试验 Firebase Analytics,这是一个非常类似于 Google OHA only 的产品,我不认为它可以在 Google 生态系统之外工作(尽管有 @987654322 @确实如此)。 firebase 的部分设置是应用 google-services 插件。
apply plugin: 'com.google.gms.google-services'
但是,withAmazon 风格不包括 google-service.json ...因为...嗯,它不适合 Google。
app
|_ main
|_ test
|_ withAmazon
|- java
|- AndroidManifest.xml
|_ withGoogle
|- java
|- AndroidManifest.xml
|- google-services.json
...但是由于Gradle plugins appear to need to have to be applied project wide 是否可以仅将 gms 插件应用于其中一种风味?在编译 Amazon 风格时,在上述场景中构建失败,因为它抱怨 google-services.json 不存在......这是正确的。
目前,我的解决方法是将google-services.json 移动到app/ 目录下。问题解决了。但是,我感觉 Google 和“纯”Android 操作系统之间的明确界限正在被侵犯。
任何慷慨的帮助。
【问题讨论】:
-
然后将 firebase 设为
withGoogle风味的一部分,或者将google-services.json移至主要风味。
标签: android kindle-fire google-play-services