Is google-services.json confidential?

后端 未结 3 1223
野性不改
野性不改 2020-12-25 11:56

Following the guide on setting up Google Analytics in an Android app (https://developers.google.com/analytics/devguides/collection/android/v4/) I am left wondering if this g

3条回答
  •  星月不相逢
    2020-12-25 12:52

    Yes. At least the api_keystuff should be kept confidential.

    One way to put google-services.json into your public repository and still keep it confidential is to use BlackBox.

    In your app level build.gradle put a copy task in for example defaultConfig like this:

    defaultConfig {
        ...
        ...
        copy {
            from "../secret/"
            into "."
            include "*.json"
        }
    }
    

    which will copy the file from your secret/ folder to the right spot.

    Now, to build your app you'll have to run blackbox_edit_start google-services.json.gpg the first time you check out your repo, and after that you're good.

提交回复
热议问题