


Whenever you upload your Android project on GitHub, the person that uses your repository will not be able to figure out what your API key is. If ApiKey goes red, press Make Project button or use Ctrl+F9 Last Step, access your APK key in your Java file like that private static final String API_KEY = BuildConfig.ApiKey Add this following line to your app-level adle file: android ģ. Add these two lines to the root level of your app-level adle file: def localProperties = new Properties() localProperties.load(new FileInputStream(rootProject.file("local.properties")))ģ. Add the API key to your local.properties file:Ģ.Sharing of API keys becomes more of a concern if the API key authenticates someone for access to a subset of data. buildType is read-only, so this no longer works. That’s probably the least concerning situation. Variables introduced in adle with buildConfigField are added to the BuildConfig class created at build time. It is not good to push your secret things into public repository as other people could use up your limited API calls. private static final String APK_KEY = "asjsdakf4d3ggs2ytm4x"

Some Developers store their API key in a String variable like this. I am going to show you how you can do that easily. It is considered a security glitch, so that’s why it is important to hide your API key. When you upload your Android app on GitHub, you need to hide it as no one has access to it except you.
