Eclipse and Android Development – Fixing GPS under DDMS

I am currently working on an Google Android project that require the use of the Location Services – good thing the Eclipse plugin supports this!

Running Eclipse in DDMS mode will enable a console where coordinates can be typed and sent to the debugger – very nifty. Except it didn’t work! During the first try, only the first location change came through to the UI. Later tests showed that location (regardless of input) at 0, 0 – which equals ERROR!

After spending some hours searching the internet and verifying that location changing worked by manually telnet’ing to the emulator and typing coordinates the mystery unfolded and the solution presented itself!

The problem is Eclipse locale handling (please not that ‘locale’ in this context has nothing to do with ‘location service’). In a classic case of parsing decimal strings the problem occurred in Eclipse and not in the emulator. The solution to the problem was to add a line containing “-Duser.language=en” to the eclipse.ini file (on Mac OS X this means opening the App-folder or vim’ing it from the command line). Problem solved – happy developer! :-)