How to Store Secrets in a Gradle Project

Posted: 07 Jun 2022. Last modified on 08-Jun-22.

This article will take about 1 minute to read.

Part of the fun of writing code is having other people use it! But before making your code public, you should make sure that it does not contain any secrets.

Secrets are a very blanket term for anything that your app needs to be able to run, but which should not be public knowledge. Some examples include:

Where to store secrets

In a file that’s not checked into version control In an environment variable (which you can set in the config file for your shell of choice, either ~/.bashrc or ~/.zshrc)

# ~/.gradle/