Search code examples
androiddictionarygithubapi-key

How can I hide my Google Maps API Key when sharing my code on github?


My Android application is OpenSource, and I am a little bit afraid to share the code on Github, because my API keys were also shared.

I can git ignore my strings.xml file, but I really hope there is an alternative and I will be able to do something clever, so I wont have to worry about it.

Any idea or suggestion?


Solution

  • Customize the ant build script of your project to generate a mapskey.xml (strings) from local.properties (which you add to git ignore). Those who fork just create their own local.properties with debug and release keys for Google Maps.