Protecting secrets in an Android project

Keep them out of Git and encrypt them

Andrew Lord
ProAndroidDev
Published in
6 min readFeb 16, 2020

--

When developing apps we will often need to use secret values that we don’t want anyone to get access to, such as tokens, IDs and API keys. There are many reasons they may be needed in our source code and in Gradle scripts, the most common being when we are asked to provide one to authenticate with a third-party API.

We will examine a selection of techniques that we can apply, providing protection for our secrets and preventing them from sitting in plaintext, in plain sight…

--

--

Mobile Lead @WorkiroApp . Android and iOS Engineer. Author @ http://lordcodes.com. Avid gamer and music fan.