Agree it's not so bad. Just took 2 days to figure out how to do it. 2 days I'd rather have spent making the app more awesome. If on average other developers - I like to think I'm at least average :) - spent this long then that's like a million hours that they've spent on their build config instead of making their apps more awesome.
Oh I love the way Xcode handles this. Just setup multiple targets and use a preprocessor macro to switch between configurations. A nice drop down to select from when you're building. It's bliss! Learning the iOS way took me way less time than figuring it out for Android and it was a nicer solution.
I think people view this as too techy of a solution and I think people rely on their IDEs for this sort of thing too much, but after trying to automate my Azure deployments (local web, dev emulator, prod), I finally gave up and just resorted to having to manually comment/uncomment things in files and flex dropdown boxes across Visual Studio everytime I wanted to change environments. And I paid the 45-minute deploy time tax every time I forgot to change one of them when I deployed.
I'd have killed for a simple macro syntax to use within my config files. Hell, at one point I was actually (stupidly, one of the more futile tasks I've ever tried) editting the MSBUILD files by hand.
Thanks Zambo. I couldn't find a way to set a custom debug key in Eclipse - I'm using IntelliJ but this frustrated me so much I was considering migrating to Eclipse.
I was also using a debug/release flag previously but kept forgetting to change it when I sent the release build out for testing.
Great post, I'm working on my build tonight and this'll come in handy. I usually end up just changing the Maps API key locally and never committing it which kinda sucks.
For Eclipse you can set the debug key here: Window > Preferences > Android > Build > Custom debug keystore. That's for the normal Eclipse/android build process.
Comes in handy when developing on multiple machines as you can't update an app that was signed with a different debug key (must uninstall first).