At last, Google’s much anticipated Android release – v5.0 or ‘Lollipop’ is here, and at Shinobi HQ nothing ever stands still! We were keen to ensure that ShinobiCharts for Android will play nicely with Google’s latest offering and decided to share some of our discoveries.
Let’s get started
First port of call was the Google developers’ documentation, which gave a good overview of what the main differences are, and how we should approach ensuring compatibility. The articles highlighted several areas which we felt worthy of further investigation:
- Android now comes with a new Runtime, known as ART (See here for a good overview of ART). Whilst most Android applications are expected to work under ART, applications which employ the following (amongst other things) can experience problems:
- Use of the JNI (Java Native Interface) to run C/C++ code
- Use of obfuscating tools
- Applications that use the Android NDK (Native Development Kit) should be rebuilt using the latest release of the NDK, as this includes 64 bit support. Whilst of course 32 bit applications are supported by Lollipop, this NDK update will ensure that apps running on a 64 bit machine will be able to take full advantage of aspects such as the extra address space which 64 bit architecture brings.
Nothing beats the real thing!
We didn’t want to rely on emulation given the nature of the changes, and tested on the latest Nexus products. It’s worth noting here that as we were keen to highlight any JNI related exceptions, we ran these tests with CheckJNI enabled – you can read about this here. The process of testing wasn’t straight forward and several times we came across the “Unfortunately, ShinobiAndroidTest has stopped”… in the majority of cases log files revealed:
JNI DETECTED ERROR IN APPLICATION: jarray was NULL in call to GetFloatArrayElements…
Referring back to the guidelines laid out by Google, we meticulously walked through our code, working through Google’s checklist of things to look out for. It would appear that ART is much stricter than Dalvik! In a number of places we were passing null to our JNI layer, where an array of floats was expected. Replacing this null for an empty float array cured almost all of the issues.
Once tested and stable on both 64 / 32 bit devices and L / pre-L versions of Android, we were keen to enable the gains offered by 64 bit architecture in our charts. This turned out to be relatively painless, we simply imported the latest NDK into our build and made a minor modification to our application.mk file:
APP_ABI := all
This gave us an additional set of .so files which are bundled into our .apk; effectively a 64 bit version for arm, x86 and mips architecture. Finally with basic testing complete, we performed a full QA execution on 64 bit and 32 bit hardware and on both Android L and pre-L versions. We tested right back to API level 9 (Gingerbread) to ensure proper compatibility.
The latest version of Android brings with it many benefits, ranging from its beautiful new Material Design to its ability to run on 64 bit hardware. Whilst the majority of applications will work without the need for modification, some applications will require a little work to be compatible with Lollipop. We found a great deal of good quality information and documentation available, you can find a selection of useful links below. The process wasn’t completely painless, but was not a difficult endeavour and we’re happy to be ready to use all of the new features. If you are new to ShinobiCharts and keen explore its features, why not download a free trial today! If you are an existing customer, be sure to download the latest version, v1.7.1 from our customer portal.