Friday, August 28, 2015

No Java 8: No JSON for you says Android: UnsupportedClassVersionError: org/json/JSONObject

Let's say you are crazy enough to be running the Ubuntu Long Term Support distribution.  Maybe you would even rather like to use the jdk package from the Ubuntu repo so it gets automatically updated?  Android says: No; not if you feel like using JSON.

java.lang.UnsupportedClassVersionError: org/json/JSONObject : Unsupported major.minor version 52.0

No you won't be able to just change the JSON version in Maven like others who get stuck with it.  You will upgrade to JDK 8 or your code will not run.  Developer's using JSON: wow, what an edge case, eh?  Who would possibly expect Google to conduct enough testing to figure that one out and say "Hey - you have to use JDK 8 to compile from now on".

Wednesday, August 12, 2015

Android emulator SNAFU: Eating 100% CPU when idle

Fresh from the "who could have expected Google to try that edge case?" list: the case of Android emulators eating 100% of the CPU when Idle on Linux.  It's very complex to reproduce:

  1. Start any Android emulator on any Ubuntu Linux machine
  2. Watch it eat 100% of a CPU core when doing nothing after bootup has completed
The issue is noted on a bug report where someone from Google looked at it 4 years ago to say "huh I can't make it happen".

The solution? Hope you don't need audio: run export QEMU_AUDIO_DRV=none ; then run your emulator.

SNAFU: Regularly used in Afghanistan, particularly if you speak to anyone who was working with the military. Situation Normal All F***ed Up.  Also highly applicable to many Android development situations it seems.