The online home of Brave Location Services Ltd.

Android Issues with Proguard and GSON

Fixing a tricky bug only found in production in my Android app

I don’t do much native Android development, but when I do I always learn something new.

I was working on my Yeltzland app, but then one of my users (thanks DJ!) told me the league table view hadn’t been working for a while on Android

I couldn’t repro this at all, until I installed the app from the Play Store and saw the same issue.

What I’d done a few weeks ago was get Proguard and other app size minification working, obviously to reduce the size of the app.

What I didn’t know is there are issues with the miniification of the generated classes used to parse the incoming JSON data feed when using GSON, which was causing the problem.

A bit of research found this template with the Proguard settings, and with a bit of experimentation I managed to fix it.

It’s pretty obscure that the GSON library can’t handle this itself, but I’m on the edge of my knowledge here so presumably there are good reasons??

I don’t use the Android app daily so hadn’t noticed the bug in the production app, but thought I’d post this just in case someone has the same issue.