Question

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?

Was it helpful?

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.

OTHER TIPS

Put the key in a separate file and read it from there, and only commit a placeholder file to the repository.

If strings.xml is required by the program, then it should be included in the source, but strings specific to each user of the source should be left out. In their place, provide documentation on where the specific strings should be included.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top