Search code examples
androidfirebasekeystorecirclecigoogle-play-services

Adding Google-services.json for CircleCI to function, on a public repository


I've linked my Android project repository to CircleCI and when I build, I got an gradlew lint error saying that google-services.json is not present. Is there any way to add google-services.json to my project, without committing it to the repository?

I'm using firebase as backend for my project


Solution

  • disclaimer: CircleCI Developer Advocate

    I'm not too familiar with google-services.json so I'll mention a few possible solutions and you can see what might work best for you.

    1. If the file is small enough, you can base64 encode the file, store it on CircleCI as a private environment variable, and then during a build decode the variable back to the file.

    2. If an API key is the only secret part of the file, you could store the API key in a private environment variable, replace it in the file with template text such as %API_KEY%, and then during a build, replace the template text with the key using sed.

    3. Encrypt the entire file before committing it and store the decrypt key as a private environment variable.

    4. Store the file somewhere secure and use SSH to retrieve it during a build.

    Useful links: - CircleCI Environment Variables - sed - base64