google-services.json
Firebase Android plugin 使用的文件通常放在应用程序的模块文件夹中。
我想要做的是将这个文件完全放在项目文件夹之外的文件系统上的某个位置,然后让 gradle/Firebase 插件从那里读取它。
我想把它的位置放在 local.properties
并以某种方式“告诉”Firebase 插件以获取 google-services.json
的位置从那里。
我怎样才能做到这一点?
最佳答案
根据offical documentation , google-services.json
文件一般放在app/ directory
(位于 Android Studio 应用模块的根目录)。从 2.2.0 版开始,插件支持构建类型和产品 flavor 特定的 JSON 文件。以下所有目录结构均有效:
// dogfood and release are build types.
app/
google-services.json
src/dogfood/google-services.json
src/release/google-services.json
...
Note: Providing a google-services.json file in the release directory allows you to maintain a separate Firebase project for your production APKs. When product flavors are in use these more complicated directory structures are also valid.
// free and paid are product flavors.
app/
google-services.json
src/dogfood/paid/google-services.json
src/release/free/google-services.json
...
作为结论,您不能添加
google-services.json
项目之外的文件。希望能帮助到你。
关于android - 从本地文件系统加载 google-services.json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46444371/