Another submission for the Dragonbox coding competition, Applimulator provides an unusual prospect : being able to run some Android games directly from your Linux session. Not all applications can be made to run, however, and limitations are numerous. But what is there to complain about when you can now run Angry Birds without having to switch systems?
You may first wonder how this even came to be. Before we go into the review of Applimulator itself, it is worth taking some time to understand how this all works. The critical piece behind Applimulator is the apkenv piece, developed by thp (github | site). crow_riot from the Pandora community has ported it on Pandora and packaged it together with a rudimentary UI to launch programs.
Under the hood, apkenv actually uses native libraries to execute apk’s aimed at the Android ecosystem. So, for starters, as crow_riot himself recognizes:
if there’s a lib/armeabi or the like folder, there’s at least a starting point. if not, then you can just stop trying at this early stage.
Then the tedious work begins: you throw such apk’s at apkenv to see what runs or not. And if it does not run, you are in it for some time:
sometimes functions that are available on android are not directly available on the pandora (or any other supporting device). apkenv tells you the names and then you’ve got to write wrapper functions for them. It just stops at the first function not found and tells you that it’s not available. You repeatedly need to do that until the lib finally links.
Unfortunately it does not stop there. Linking the lib is just another step to reverse the java code:
Knowing the the lib is linkable, you need to start reversing the java code, the classes.dex file that comes with each apk – tools used are dex2jar+jd-gui. having some decompiled sources you can start searching for native labeled functions definitions, these are the ones that are called from the java side. Mostly, thats a handful (like nativeInit, nativeRender, nativeInput, …).
You thought the fun was over? Not so fast.
Knowing all native functions, you can actually start writing a module, first all native function definitions need to be translated to C function definitions, which is easy. It’s step-by-step, first do the JNI_OnLoad if it’s there, then nativeInit is usually called. and then you can start watching the console for java functions that are called. And every little java call needs to be emulated. Then continue with nativeUpdate and see what java calls are there and so on.
Unfortunately, even if you follow all these steps to write a module, most of the time it ends in a segfault. So Applimulator is not a miracle solution to provide you with tons of new games. For every title a new module needs to be written, hence it is extremely time consuming.
Fortunately, users do not have to worry about the above inner workings to use Applimulator. The software comes with a launcher, and the only thing you need to worry about is finding the right apk packages and put them in the right folder on your card. Once you are done, you just have to select the game in the said launcher.
Now, the compatibility list is, as expected, pretty short. So far, you can run the following games:
- Fruit Ninja 1.5.4, normal or HD version
- Angry Birds Space 1.1.0
- Angry Birds Space HD 1.0.1
- Angry Birds Season HD 1.3.0
- Angry Birds Season 2.5.0
- Angry Birds Rio 1.4.4
- Angry Birds 2.3.0
- Cut the Rope 1.0.0 up to 1.3.1
- Amazing Alex HD 1.0.0
The performance on screen is nonetheless very impressive. When running Angry Birds under Android on my Pandora at 800 Mhz or even 900 Mhz, it has never felt really right, performance-wise, while apkenv seems to make it run with more frames per second, and feels smooth even at 600Mhz. Fruits Ninja also loaded perfectly and performed very well on the Pandora. Last but not least, Amazing Alex, the incredible-machine like game from the creators of Angry Birds, Rovio, also runs very well. This is probably due to the fact that it uses the exact same engine as Angry Birds..
While the Pandora’s resistive touchscreen can only detect single screen presses, crow_riot has implemented a solution for this problem by emulating multi-touch using the shoulder buttons: pressing the left shoulder button emulates a second pressure at the center of the screen. For Angry Birds, this does wonders when you want to zoom/unzoom. It becomes even easier than using two fingers on an actual Android device!
Overall, I see apkenv as a very successful proof of concept while it has yet to yield more titles in terms of compatibility. So far, crow_riot‘s focus has been on running games, but one may wonder how well would Applimulator do in the realm of actual Android applications. What could be interesting would be to use apkenv to run certain apps currently missing on Pandora. Skype comes to mind as a very desirable candidate (since it does not even run under Android on Pandora due to mic drivers issues). crow_riot is apparently looking at that for future versions. Let’s pray a module can be written for that one.
In the beginning crow_riot was also looking at apkenv to be able to run Unity player in order to facilitate the execution of games based on the Unity engine for Android. If this ever works, this would be a game-changer for apkenv. Ever checked what games were released on Android using Unity ?
Anyway, well done crow_riot, and many of us are looking forward to updates to this already very promising software.
For more on this: