Neil Rajah is the first project where I tried to use ProGuard. The initial setup took some trial and error, but some Google searches mostly sorted that out. I had entries in the config file for libGDX, Mobclix, Flurry, most of the important libraries that I use. The game’s been out for a month, and no one’s really reported major problems.
I’ve always had a nagging feeling at the back of my mind that maybe my game is crashing all over the place, and I’m just not getting to know about it. But ACRA was working, I got crash reports when I was debugging the game, so I put that down as paranoia. I never got any ACRA crash reports from the field, and didn’t really give that much thought. You can probably see where this is going…
Yesterday, on a whim, I thought about checking crash reports on Flurry. And that confirmed my fears – my game has been crashing, and ProGuard had optimized out ACRA, so I wasn’t getting any crash reports from my release build. Awesome. I was working on an update anyway, so I thought, what the heck, I’ll just disable ProGuard, I’m not sure it’s really buying me that much anyway. Big mistake. Big big mistake.
I’m using Google’s GSON library to serialize the save game state to a JSON string, which gets saved to the SharedPreferences. You can probably see where this is going too. Once I removed the ProGuard obfuscation, the class names changed, and now my game couldn’t read the save game data any more. If the user plays through a level, the game will write the new data out, which will erase the old data. A friend notified me of this problem, and I disabled the game on the Google Play store as soon as I figured out what was going on. But I was still worried about all the negative reviews I was going to get because of this.
And then I remembered – Swarm has a push notification feature. I quickly created a page on my blog explaining what I’d done, and sent out notifications to all users running the affected versions. I’m not sure how much of an impact that will have, and it will really suck for anyone who loses their progress through the game. But I’m hopeful that I’ll be able to get through to most of the affected users before they lose their data. And hopefully people will understand that this was a genuine mistake, and I’m trying to fix it, and won’t be annoyed by the push notification. We’ll see.
So, moral of the story – if you’re thinking about using ProGuard, make sure you plan ahead better than I do.
